ggreen86 / XLSX-Workbook-Class

VFP Class to Create an XLSX Workbook without Excel Automation or Installed
45 stars 16 forks source link

Question about basic steps to convert XLS file to XLSX #77

Closed nmossvfp closed 1 year ago

nmossvfp commented 1 year ago

Hi Greg,

Is there is a simple demo for conversion of an .XLS file to an .XLSX file using the XLSX-Workbook Class ? m.xfile = "c:\data\myfile.xls" m.newfile = "c:\data\myfile.xlsx"

I use your class and am grateful for your work but I have even more queries which I rely on that use the native VFP Copy TO XLS command. Recently, this has become more and more of an issue for me as clients lock down the .XLS file type with read-only and strong warning message due to it's infrequent use nowadays.

jhernancanom commented 1 year ago

Colleague: You are confused about this library.

With this library you can convert a cursor/DBF/table/grid to an XLSx spreadsheet.

What you need to do is change the VFP' COPY TO command in you application for one of the following VFPxWorkbookXlsx's functions.

You can use any of this functions (you can see them in the documentation):

SaveGridToWorkbook Saves the passed grid to a workbook in xlsx file format. Uses the grid column widths to set the workbook column widths. Adds a new sheet for each passed grid if the same workbook name.

SaveGridToWorkbookEx Saves the passed grid to a workbook in xlsx file format by writing directly to the XLSX files and does not write to the internal cursors; hence, this is the fastest way to create a XLSX file from a grid.

SaveTableToWorkbook Saves the passed table to a workbook in xlsx file format. Adds a new sheet for each passed table if the same workbook name.

SaveTableToWorkbookEx Saves the passed table to a workbook in xlsx file format by writing directly to the XLSX files and does not write to the internal cursors; hence, this is the fastest way to create a XLSX file from a table or cursor. You can also pass an array of the fields that are to be included in the export.

SaveWorkbook Saves the selected workbook to xlsx file format based on the name set at creation of the workbook

SaveWorkbookAs Saves the selected workbook to xlsx file format with the supplied file name; resets the workbook file name for future saves

ggreen86 commented 1 year ago

Hello--

The XLS format is not supported by the workbook class as it is not based on xml. As such, the class cannot open the xls workbook. You would need to use automation of Excel or other methods to read the workbook.

Greg


From: nmossvfp @.> Sent: Tuesday, December 27, 2022 5:14 PM To: ggreen86/XLSX-Workbook-Class @.> Cc: Subscribed @.***> Subject: [ggreen86/XLSX-Workbook-Class] Question about basic steps to convert XLS file to XLSX (Issue #77)

Hi Greg,

Is there is a simple demo for conversion of an .XLS file to an .XLSX file using the XLSX-Workbook Class ? m.xfile = "c:\data\myfile.xls" m.newfile = "c:\data\myfile.xlsx"

I use your class and am grateful for your work but I have even more queries which I rely on that use the native VFP Copy TO XLS command. Recently, this has become more and more of an issue for me as clients lock down the .XLS file type with read-only and strong warning message due to it's infrequent use nowadays.

— Reply to this email directly, view it on GitHubhttps://github.com/ggreen86/XLSX-Workbook-Class/issues/77, or unsubscribehttps://github.com/notifications/unsubscribe-auth/AGWB33NHVZYYJYF3T5DYKN3WPNS3VANCNFSM6AAAAAATKYBJHQ. You are receiving this because you are subscribed to this thread.Message ID: @.***>

nmossvfp commented 1 year ago

The XLS format is not supported by the workbook class <<<

Ok. That makes sense and is something I didn’t realize.

Also as jhernancanom suggested in an earlier answer reply (Thanks) I can add run the same data query that would have produced the XLS output but instead of COPY TO XLS, I can use SaveTableToWorkbook function in XLSX Workbook class and create my .XLSX that way. Is that basically correct?

From: ggreen86 @.> Sent: Wednesday, December 28, 2022 7:16 AM To: ggreen86/XLSX-Workbook-Class @.> Cc: nmossvfp @.>; Author @.> Subject: Re: [ggreen86/XLSX-Workbook-Class] Question about basic steps to convert XLS file to XLSX (Issue #77)

Hello--

The XLS format is not supported by the workbook class as it is not based on xml. As such, the class cannot open the xls workbook. You would need to use automation of Excel or other methods to read the workbook.

Greg


Hi Greg,

Is there is a simple demo for conversion of an .XLS file to an .XLSX file using the XLSX-Workbook Class ? m.xfile = "c:\data\myfile.xls" m.newfile = "c:\data\myfile.xlsx"

I use your class and am grateful for your work but I have even more queries which I rely on that use the native VFP Copy TO XLS command. Recently, this has become more and more of an issue for me as clients lock down the .XLS file type with read-only and strong warning message due to it's infrequent use nowadays.

— Reply to this email directly, view it on GitHubhttps://github.com/ggreen86/XLSX-Workbook-Class/issues/77, or unsubscribehttps://github.com/notifications/unsubscribe-auth/AGWB33NHVZYYJYF3T5DYKN3WPNS3VANCNFSM6AAAAAATKYBJHQ. You are receiving this because you are subscribed to this thread.Message ID: @. <mailto:@.> >

— Reply to this email directly, view it on GitHub https://github.com/ggreen86/XLSX-Workbook-Class/issues/77#issuecomment-1366608890 , or unsubscribe https://github.com/notifications/unsubscribe-auth/ANUTMD5CP6VONEDY3PDHVYDWPQVOZANCNFSM6AAAAAATKYBJHQ . You are receiving this because you authored the thread. https://github.com/notifications/beacon/ANUTMD7DFAQ6A6SGO7RATFLWPQVOZA5CNFSM6AAAAAATKYBJHSWGG33NNVSW45C7OR4XAZNMJFZXG5LFINXW23LFNZ2KUY3PNVWWK3TUL5UWJTSROTF7U.gif Message ID: @. @.> >

ggreen86 commented 1 year ago

Yes, you can save a cursor or table to a XLSX format using the method.


From: nmossvfp @.> Sent: Wednesday, December 28, 2022 1:40 PM To: ggreen86/XLSX-Workbook-Class @.> Cc: ggreen86 @.>; Comment @.> Subject: Re: [ggreen86/XLSX-Workbook-Class] Question about basic steps to convert XLS file to XLSX (Issue #77)

The XLS format is not supported by the workbook class <<<

Ok. That makes sense and is something I didn’t realize.

Also as jhernancanom suggested in an earlier answer reply (Thanks) I can add run the same data query that would have produced the XLS output but instead of COPY TO XLS, I can use SaveTableToWorkbook function in XLSX Workbook class and create my .XLSX that way. Is that basically correct?

From: ggreen86 @.> Sent: Wednesday, December 28, 2022 7:16 AM To: ggreen86/XLSX-Workbook-Class @.> Cc: nmossvfp @.>; Author @.> Subject: Re: [ggreen86/XLSX-Workbook-Class] Question about basic steps to convert XLS file to XLSX (Issue #77)

Hello--

The XLS format is not supported by the workbook class as it is not based on xml. As such, the class cannot open the xls workbook. You would need to use automation of Excel or other methods to read the workbook.

Greg


Hi Greg,

Is there is a simple demo for conversion of an .XLS file to an .XLSX file using the XLSX-Workbook Class ? m.xfile = "c:\data\myfile.xls" m.newfile = "c:\data\myfile.xlsx"

I use your class and am grateful for your work but I have even more queries which I rely on that use the native VFP Copy TO XLS command. Recently, this has become more and more of an issue for me as clients lock down the .XLS file type with read-only and strong warning message due to it's infrequent use nowadays.

— Reply to this email directly, view it on GitHubhttps://github.com/ggreen86/XLSX-Workbook-Class/issues/77, or unsubscribehttps://github.com/notifications/unsubscribe-auth/AGWB33NHVZYYJYF3T5DYKN3WPNS3VANCNFSM6AAAAAATKYBJHQ. You are receiving this because you are subscribed to this thread.Message ID: @. <mailto:@.> >

— Reply to this email directly, view it on GitHub https://github.com/ggreen86/XLSX-Workbook-Class/issues/77#issuecomment-1366608890 , or unsubscribe https://github.com/notifications/unsubscribe-auth/ANUTMD5CP6VONEDY3PDHVYDWPQVOZANCNFSM6AAAAAATKYBJHQ . You are receiving this because you authored the thread. https://github.com/notifications/beacon/ANUTMD7DFAQ6A6SGO7RATFLWPQVOZA5CNFSM6AAAAAATKYBJHSWGG33NNVSW45C7OR4XAZNMJFZXG5LFINXW23LFNZ2KUY3PNVWWK3TUL5UWJTSROTF7U.gif Message ID: @. @.> >

— Reply to this email directly, view it on GitHubhttps://github.com/ggreen86/XLSX-Workbook-Class/issues/77#issuecomment-1366847881, or unsubscribehttps://github.com/notifications/unsubscribe-auth/AGWB33MFSFLTHQGPOYHPNNTWPSCR3ANCNFSM6AAAAAATKYBJHQ. You are receiving this because you commented.Message ID: @.***>