Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
VfpxWorkBookXlsx
Message
 
 
À
07/10/2020 11:49:00
Information générale
Forum:
Visual FoxPro
Catégorie:
Produits tierce partie
Divers
Thread ID:
01676306
Message ID:
01676504
Vues:
30
>>>>>I tested with the beta 10 version that I sent to you and the return values are correct. Please see the attached screen shot.
>>>>
>>>>Thank you.
>>>
>>>BTW -- there are two methods for exporting a table to a workbook. The first method (which you are using) is SaveTableToWorkbook(); this method saves the table into the internal xl_* named cursors. This allows you to be able to add formatting and other features to the workbook before saving. But this is the slowest method to saving a workbook. The second method is SaveTableToWorkbookEx() which saves the table directly to the workbook with limited formatting. The formatting is defaulted by field type and font name/size is set as a property value. This is a much faster output to create the workbook.
>>
>>
>>Could you please help me understand the difference between the SaveTableToWorkBook() and SaveTableToWorkBookEx(). You said:
>>"This allows you to be able to add formatting and other features to the workbook before saving."
>>Do you add formatting in code?
>>Also, if the user does not need to add any formatting and other features, are the resulting XLSX files identical with either method?
>
>The method SaveTableToWorkBook() saves the table to the internal xl_* cursor tables and optionally will save the workbook to file; you have always been saving to file with the True parameter option. However, you can set this to False and not immediately save the workbook. Now that the table is loaded into the cursor tables, you can do more with it. You can now use any of the class methods to add formulas, set cell formatting (color, borders, font, etc.), set column/row groupings, and more. Once you have finalized any formatting or adding more rows/sheets, you can now save the workbook with the SaveWorkbook() or SaveWorkbookAs() method. This allows you to add multiple sheets and set the formatting as desired/needed.
>
>The method SaveTableToWorkBookEx() saves the table directly to the workbook. The xl_* cursors are not used. The only formatting is based on column value type and the font/size setting in the class properties. The first row text is set to bold and can also be frozen. No other formatting is possible during the output process.
>
>Since SaveTableToWorkBookEx() saves directly to the xml files using FWRITE() command, it is very fast. I have tried to optimize the output so that only one pass through the table to be outputted is necessary. The SaveTableToWorkBook() first saves to the xl_* cursors and then these same xl_* cursors has to be queried to now save to the xml files; so the output is considerably slower in creating the workbook.
>
>The SaveGridToWorkBookEx() is similar to SaveTableToWorkBookEx(); however, it takes the formatting from the grid columns. This method also writes directly to the workbook xml files. SaveGridToWorkBook() is like SaveTableToWorkBook() in that it saves to the internal xl_* first.
>
>Greg

When I use the SaveTableToWorkBookEx(), the XLSX file is created faster. But when trying to open the resulting XLSX file, I get an error message (from MS Excel):
We found a problem with some content in 'TEST_VER10_EX.XLSX' Do you want us to try to recover ....
I said Yes.
The XLSX file is open with the message:
Repaired Records: String properties from /xl/worksheets/sheet1.xml part
Using SaveTableToWorkBook() is slower but no error message.
"The creative process is nothing but a series of crises." Isaac Bashevis Singer
"My experience is that as soon as people are old enough to know better, they don't know anything at all." Oscar Wilde
"If a nation values anything more than freedom, it will lose its freedom; and the irony of it is that if it is comfort or money that it values more, it will lose that too." W.Somerset Maugham
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform