Home > Back-end >  BCB by ole export XLS, computer installation is excel2007, export excel2000-2003 format?
BCB by ole export XLS, computer installation is excel2007, export excel2000-2003 format?

Time:10-22

As title, BCB through ole export XLS, computer installation is excel2007, export excel2000-2003 format?

CodePudding user response:

The code

The Variant Exout, Wbout Shout1;
The Variant Rangeout;
Exout=the Variant: : CreateObject (" Excel. Application ");
Exout. PG (" workbooks "). The FN (" add ", 1);
ActiveWorkBook Wbout=Exout. PG (" ");
ActiveSheet Shout1=Wbout. PG (" ");
Shout1. PG (" Cells ", 1, 1), PS (" Value ", t1 c_str ());
Shout1. PG (" Cells ", 1, 2). PS (" Value ", t2 c_str ());
Shout1. FN (" SaveAs ", "c: \ \ test. XLS");
Wbout. PR (" Close ");
Exout. OleFunction (" Quit ");

Can export XLS file, excel2007 can open, but the back of the application can only support excel97-2003 version of the.xls format, can't identify, if the installation excel2003 computer export XLS is no problem,

I recorded under excel2007 "save as excel97-2003" macro as follows:
Exout. PG (" ActiveWorkbook SaveAs Filename="C: \ Users \ pkgd3 \ Documents \ Book2 XLS" _
FileFormat:=xlExcel8, Password:="", WriteResPassword:=", "_
ReadOnlyRecommended:=False, CreateBackup:=False
There is an output format parameters "FileFormat:=xlExcel8",
But how to implement under BCB6?

CodePudding user response:

Call demon elder brother

CodePudding user response:

OLE profession to also!!!!!! When you save the specified file format.

 String strFileName="C: \ \ Users \ \ pkgd3 \ \ Documents \ \ Book2 XLS"; 
ActiveWorkbook Exout. PG (" "). FN (" SaveAs ",
WideString (strFileName),
56,//FileFormat:=xlExcel8,
"",//Password:=", "
"",//WriteResPassword:=", "_
False,//ReadOnlyRecommended:=false,
False//CreateBackup:=false
);
  • Related