Home > database >  With PB how to import the excel or word to do
With PB how to import the excel or word to do

Time:10-04

City door industry code name address phone
XX co., LTD., 410000, 10060400 XXX road 659531510
A000000335 & amp; nbsp; Office 66340705
Room 66340701 A000000335 A000000335 market customer service 66340720 A000000335 sales room 66340732

XX co., LTD., 410002, 10060401 XXX road 652531510
A000000336 office 66540705
Room 66540701 A000000336 A000000336 market customer service 66540720 A000000336 sales room 66540732
The format of the like this, don't know how to do it, prawns help me!!!!!!

CodePudding user response:

Useful to ole.
It is ok to go and see.

CodePudding user response:

no

CodePudding user response:

Operated by ole to excel or word (to many examples, use vba, online to find)

CodePudding user response:

Solution to the problem that a lot, please, you soso ask here, looking for don't directly ask, I don't like the batman, to be a programmer, don't have any own the ability to solve the problem. I hope my words are helpful to you.

CodePudding user response:

What qualifications do you have to say Lao tze, upstairs, Lao tze not SO we can ask you what,,, you don't like Lao tze like batman, Lao tze also not let you answer, and can't answer you won't keep you in this the shit, small fart child a,

CodePudding user response:

With data window directly, through a dw_1 saveas () function can be

CodePudding user response:

Saveas () or SAVEASASCILL (), if there is a requirement for format with OLEOBJECT variable or OLE controls, to connect and then written line by line, this information also some online,

CodePudding user response:

//function function: exported as WORD document
//the function name: f_outputtoword_new
//input: now adws - datawindow, specified data window
//return values: an Integer
Constant integer ppLayoutBlank=12
OLEObject ole_object
Ole_object=CREATE OLEObject
The integer li_ret
Li_ret=ole_object. ConnectToObject (" ", "word. Application")
IF li_ret & lt;> 0 THEN
//if the Word is not open, the new,
Li_ret=ole_object. ConnectToNewObject (" word. Application ")
If li_ret & lt;> 0 then
MessageBox (' OLE errors', 'OLE unable to connect! Error number: "+ string (li_ret))
Return 0
End the if
Ole_object. Visible=True
END the IF
Long ll_colnum, ll_rownum
Constant long wdWord9TableBehavior=1
Constant long wdAutoFitFixed=0
Constant long wdCell=12
String ls_value
Pointer oldpointer
Oldpointer=SetPointer (HourGlass!
String ls_objects ls_obj, ls_objs [], ls_objtag []
Long ll_pos ll_len, ll_num=0
Ls_objects=trim (now adws. The Describe (' datawindow. Objects'))
Do the while (pos (ls_objects, "~ t") & gt; 0)
Ll_pos=pos (ls_objects, "~ t")
Ll_len=ll_pos - 1
Ls_obj=left (ls_objects ll_len)
If (now adws. The Describe (ls_obj + 'type')='column' or & amp;
Now adws. The Describe (ls_obj + 'type')='compute') and & amp;
(now adws. The Describe (ls_obj + 'band')='detail') and (ls_obj & lt;> "Asd") then
Ll_num +=1
Ls_objs [ll_num]=ls_obj
Ls_objtag [ll_num]=now adws. The Describe (ls_obj + 'tag')
End the if
Ls_objects=right (ls_objects, len (ls_objects) - ll_pos)
Loop
//get the number of columns and rows data window (line number should be a data row number + 1)
Ll_colnum=ll_num
Ll_rownum=now adws. Rowcount () + 1
Ole_object. Documents. The Add ()
Ole_object. ActiveDocument. Tables. The Add (ole_object. Selection. Range, ll_rownum, ll_colnum)
String ls_colname
Integer I, j, k
For I=1 to ll_colnum
//get the header name
[I] ls_value=https://bbs.csdn.net/topics/ls_objtag
Ole_object. Selection. TypeText (ls_value)
For k=1 to f_cncharnum (ls_value)
Ole_object. Selection. TypeBackspace ()
Next
Ole_object. Selection. MoveRight (wdCell)
Next
Now adws. Setredraw (false)
Ole_object. Selection. MoveLeft (wdCell)
String column_name
For I=2 to ll_rownum
For j=1 to ll_colnum
Column_name=ls_objs [j]
If now adws. The Describe (column_name + 'type')='column' then
Ls_value=https://bbs.csdn.net/topics/adw.Describe (" the Evaluate (' LookupDisplay (column_name "+ +") ", "+ string (I - 1) +") ")
End the if
If now adws. The Describe (column_name + 'type')='compute' then
Ls_value=https://bbs.csdn.net/topics/adw.Describe (" the Evaluate (" "+ now adws. The Describe (column_name + 'expression') +" ", "+ string (I - 1) +") ")
End the if
Ole_object. Selection. MoveRight (wdCell)
Ole_object. Selection. TypeText (ls_value)
For k=1 to f_cncharnum (ls_value)
Ole_object. Selection. TypeBackspace ()
Next
Next
Next
Now adws. Setredraw (true)
Constant long wdFormatDocument=0
SetPointer (oldpointer)
//save the new document
If messagebox (" save ", "the document has been successfully completed, whether to save?" That Question! YesNo!)=1 then
String docname, named
An integer value
Value=https://bbs.csdn.net/topics/GetFileSaveName (" select Files ", docname, named, "DOC", "DOC Files (*.doc), *. DOC")
IF the value=https://bbs.csdn.net/topics/1 THEN
Ole_object. ActiveDocument. SaveAs (docname, 0, False, "", True," ", False, False, False, False, False)
End the if
End the if
//disconnect OLE
Ole_Object. DisConnectObject ()
Destroy Ole_Object
Return 1

CodePudding user response:

//function function: export EXCEL document

//the function name: f_outputtoexcel_new

nullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnull
  • Related