Home > Software engineering >  VB2008 Word text, operation table
VB2008 Word text, operation table

Time:10-05

 

Copy the following code from Microsoft to help out, always run after the first table to establish the following problems (problems with 10001) :
"The called party refuses to accept call, (abnormal from HRESULT: 0 x80010001 (RPC_E_CALL_REJECTED)"
Immediate window appears: the first time in System.Runtime.InteropServices.COM Exception occasional "" type of Exception

Consult ace, show reason,

Dim oWord As Word. Application
Dim oDoc As Word. The Document
Dim oTable As Word. Table
Dim oPara1 As Word. Com.lowagie.text.paragraph oPara2 As Word. Com.lowagie.text.paragraph
Dim oPara3 As Word. Com.lowagie.text.paragraph oPara4 As Word. Com.lowagie.text.paragraph

'to create a document
OWord=CreateObject (" Word. Application ")
OWord. Visible=True
ODoc=oWord. Documents. The Add

Inserts a paragraph
'OPara1=oDoc. Content. Paragraphs. The Add
OPara1. Range. The Text="1, the input parameters"
OPara1. Range. The Font, Bold=True
OPara1. Format. SpaceAfter=6
OPara1. Range. InsertParagraphAfter ()

Inserts a paragraph
'OPara2=oDoc. Content. Paragraphs. The Add (oDoc. Bookmarks. Item (" \ endofdoc "). The Range)
Basic parameters oPara2. Range. The Text="1.1"
OPara2. Range. The Font, Bold=False
OPara2. Format. SpaceAfter=6
OPara2. Range. InsertParagraphAfter ()

'insert a table 2 x6,
Dim As Integer c
OTable=oDoc. Tables. The Add (oDoc. Bookmarks. Item (" \ endofdoc "). The Range, 2, 6)
OTable. Range. ParagraphFormat. SpaceAfter=6
With oTable
Cell (1, 1). The Range. The Text="gas"
Cell (1, 2). The Range. The Text="water"
Cell (1, 3). The Range. The Text="wall"
Cell (1, 4). The Range. The Text="geothermal
"Cell (1, 5). The Range. The Text="predict"
Cell (1, 6). The Range. The Text="predict"

Cell (2, 1). The Range. The Text=sinGasRelativeDensity
Cell (2, 2). The Range. The Text=sinWaterDensity
Cell (2, 3). The Range. The Text=sinConFlowPreRoughness
Cell (2, 4). The Range. The Text=sinConFlowTempGr
Cell (2, 5). The Range. The Text=sinStaticP
Cell (2, 6). The Range. The Text=sinStaticT

OTable. Rows. The Item (1) Range. The Font, Bold=True
OTable. Rows. The Item (1) Range. The Font. Italic=False
. Borders. InsideLineStyle=WdLineStyle. WdLineStyleSingle
. Borders. OutsideLineStyle=WdLineStyle. WdLineStyleSingle

End With

Inserts a paragraph
'OPara3=oDoc. Content. Paragraphs. The Add (oDoc. Bookmarks. Item (" \ endofdoc "). The Range) 10001
'OPara3. Range. The Text="1.2 output data
"OPara3. Range. The Font, Bold=False
OPara3. Format. SpaceAfter=24
OPara3. Range. InsertParagraphAfter ()

CodePudding user response:

There is no answer
  • Related