I want to see through the coming together of sample data in excel and data window to save, print target excel spreadsheet, how to implement?
Whether the window to define an ole object, the object types defined as excel form, to excel in the preview my goals?
If so, how to assign?
CodePudding user response:
To Excel in the insert picture example, setting a cell value is similar toOLEObject ExcelServer
The integer li_rc
String ls_path='d: \ enco \ 5094 JPG'
ExcelServer=CREATE OLEObject
Li_rc=ExcelServer. ConnectToObject (" Excel. Application ")
If li_rc & lt; 0 then
Li_rc=ExcelServer. ConnectToNewObject (" Excel. Application ")
If li_rc & lt; 0 then
Messagebox (" prompt ", "you may not install EXCEL! Please check the ")
Return
End the if
End the if
//ExcelServer
ExcelServer. Application. Workbooks. The Add ()
ExcelServer. Application. The Visible=False
//insert location b column 3 lines
ExcelServer. Application. Range (" B3 "). Select
ExcelServer. Application. ActiveSheet. Pictures. Insert (ls_path). Select
ExcelServer. Application. ActiveSheet. Saveas (' d: \ enco \ demo. XLS)
ExcelServer. Application. Workbooks. The close ()
ExcelServer. Disconnectobject ()
Destroy ExcelServer
CodePudding user response:
Oleobject eoleEole=CREATE OLEObject
//links to excel
Li_ret=eole. ConnectToObject (" ", "Excel. Application")
If li_ret & lt;> 0 then
Li_ret=eole. ConnectToNewObject (" Excel. Application ")
End the if
//-- -- -- -- -- -- -- -- -- -- -- -- --
String ls_full_name
OLEObject excelWB
Ls_full_name='excel_xltx_filename. XLTX//XLTX file name
ExcelWB=eole. Workbooks. Open (ls_full_name, 0, true, 1)
CodePudding user response:
Upstairs a great god, and did not see on the print preview statement, ask: this is the print preview printpreview activesheet as preview the content, the control to the excel program, by excel to show? Still?CodePudding user response:
Anyway, I run to printpreview excel have no action, when that step program crashed, can't quit!CodePudding user response:
Just testExcelOle. Worksheets (1). PrintPreview
Indeed, not exit Excel before the Preview, PB there will be no reaction
Why will find time to study, so
Before you to find the answer, to other great god please help