| |

VerySource

 Forgot password?
 Register
Search
View: 2308|Reply: 7

How to import the data of the fields in the data window into an existing word file? anxious

[Copy link]

1

Threads

3

Posts

4.00

Credits

Newbie

Rank: 1

Credits
4.00

 China

Post time: 2020-1-14 15:00:01
| Show all posts |Read mode
I created a word file with an empty table in it. I mean I want to take out a certain field (large text) in the data window, and then put it into the word file, in a certain grid of the table. Thank you
Reply

Use magic Report

0

Threads

9

Posts

6.00

Credits

Newbie

Rank: 1

Credits
6.00

 China

Post time: 2020-1-19 10:36:02
| Show all posts
Very troublesome, first, I haven't tried it. You can try it. Use OLE word OLE to control your word document, then get the form information of the document, and then write based on the obtained form information. Quite troublesome. Feasibility is not I promise.
Reply

Use magic Report

0

Threads

100

Posts

53.00

Credits

Newbie

Rank: 1

Credits
53.00

 China

Post time: 2020-1-22 10:00:02
| Show all posts
You refer to the following code to write the content of dw to word:
constant integer ppLayoutBlank = 12
OLEObject ole_object
ole_object = Create OLEObject

if ole_object.ConnectToNewObject ("Word.Application") <> 0 then
MessageBox ("Caption", "Connect error")
return
end if
ole_object.Visible = true
long ll_cols, ll_rows
constant long wdWord9TableBehavior = 1
constant long wdAutoFitFixed = 0
constant long wdCell = 12
string lsvalue
ll_cols = long (dw_1.object.datawindow.column.count)
ll_rows = dw_1.RowCount ()
ole_object.Documents.Add ()
ole_object.ActiveDocument.Tables.Add (ole_object.Selection.Range, ll_rows, ll_cols)
string ls_colname, ls_value
integer i, j
for i = 1 to ll_cols
ls_colname = dw_1.Describe ("#" + string (i) + ".name") + "_t"
ls_value = dw_1.Describe (ls_colname + ".text")
ole_object.Selection.TypeText (trim (ls_value))
ole_object.Selection.MoveRight (wdCell)
next
dw_1.SetRedraw (false)
ole_object.Selection.MoveLeft (wdCell)
for i = 2 to ll_rows
for j = 1 to ll_cols
dw_1.ScrollToRow (i-1)
dw_1.SetColumn (j)
ls_value = dw_1.GetText ()
ole_object.Selection.MoveRight (wdCell)
ole_object.Selection.TypeText (ls_value)
next
next
dw_1.SetRedraw (true)
constant long wdFormatDocument = 0
//ole_object.ActiveDocument.SaveAs("sample.doc",0,false,true,false,false,false,false,false)
ole_object.DisConnectObject ()
destroy ole_object
Reply

Use magic Report

0

Threads

1

Posts

2.00

Credits

Newbie

Rank: 1

Credits
2.00

 China

Post time: 2020-8-29 19:15:01
| Show all posts
oleobject ole_word
ole_word = CREATE OLEObject
ole_word.ConnectTonewObject("word.Application")
ole_word.visible=true
ole_word.Documents.add()

ole_word.selection.range.font.size = 18
ole_word.selection.range.font.name = "Song Ti"
string ls_data
ls_data ='Test how to operate word' +'~r~n~r~n'
clipboard(ls_data)
ole_word.Selection.paste()
destroy ole_word
Reply

Use magic Report

0

Threads

1

Posts

2.00

Credits

Newbie

Rank: 1

Credits
2.00

 China

Post time: 2020-8-29 19:30:01
| Show all posts
So
Reply

Use magic Report

0

Threads

1

Posts

2.00

Credits

Newbie

Rank: 1

Credits
2.00

 China

Post time: 2020-8-29 20:00:01
| Show all posts
Follow learning
Reply

Use magic Report

0

Threads

2

Posts

2.00

Credits

Newbie

Rank: 1

Credits
2.00

 China

Post time: 2020-8-29 20:15:01
| Show all posts
Study, good stuff
Reply

Use magic Report

0

Threads

2

Posts

2.00

Credits

Newbie

Rank: 1

Credits
2.00

 China

Post time: 2020-8-29 20:30:01
| Show all posts
I have seen a program for writing human words before,
He has a template. Open the template and write it in. It’s not bad.
The specific code should be searchable
Reply

Use magic Report

You have to log in before you can reply Login | Register

Points Rules

Contact us|Archive|Mobile|CopyRight © 2008-2023|verysource.com ( 京ICP备17048824号-1 )

Quick Reply To Top Return to the list