C++ Builder and Excel files
I need to generate Excel files based on database queries.
I accomplished what I wanted to some extent.
I use a TExcelApplication component to connect to Excel and fill the matrix with data gathered from a database query.
But I'm having trouble generating more than one file within the same run of the program.
The first file is ok , but when i try to load a second excel workbook it won't display anything but the header of the excel window.Besides if i try to fill a second workbook ,it causes Excel to raise an error when exiting.
Here is quite how I do it,any help regarding what is wrong will be appreciated
Second run of the below (trimmed)code does not work properly:
BTW : Conenct Kind of the component is ckRunningOrNew and AutoConnect , AutoQuit are false
TExcelWorksheet *ExcelWS = new TExcelWorksheet(this);
TExcelWorkbook *ExcelWB = new TExcelWorkbook(this);
ExcelWS->ConnectKind = Excel->ConnectKind;
ExcelWB->ConnectKind = Excel->ConnectKind;
// Fill the matrix ... this is ok ...
// save file...
ExcelWB->SaveAs((OleVariant)wcTmp,(OleVariant)xlNormal, EmptyParam, EmptyParam, (OleVariant)false, (OleVariant)false,