ggreen86 / XLSX-Workbook-Class

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

Create Workbook from template #47

Open lscheffler opened 3 years ago

lscheffler commented 3 years ago

How to create a new workbook from template? Load the template and save ander different name or si there a different way?

TIA

ggreen86 commented 3 years ago

Yes, load the workbook and then make the changes and use the SaveWorkbookAs() method.


From: Lutz Scheffler @.> Sent: Thursday, May 13, 2021 12:55 PM To: ggreen86/XLSX-Workbook-Class @.> Cc: Subscribed @.***> Subject: [ggreen86/XLSX-Workbook-Class] Create Workbook from template (#47)

How to create a new workbook from template? Load the template and save ander different name or si there a different way?

TIA

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHubhttps://github.com/ggreen86/XLSX-Workbook-Class/issues/47, or unsubscribehttps://github.com/notifications/unsubscribe-auth/AGWB33O4S5HYOL7XNAXZ5HTTNQAAXANCNFSM4424OF3A.

jhernancanom commented 3 years ago

Hi, Greg.

I am going to do it this way:

  1. From VFP, I use this sentence " copy TEMPLATE.XLSx to VENTAS_ENERO_2021.XLSx ".

  2. since XLSX-Workbook-Class I load VENTAS_ENERO_2021.XLSx, and....

  3. I make the changes I need.

  4. I use SaveWorkbook() method.

Is this a right way?

I need to confirm because with r31 I was receiving wrong results (in the way mentioned here) (hidden cols and hidden sheets appear visible, some formulas get out & stay values, several formats -bold, color-- disappear), and I am downloading last release to try.

Thanks.

HERNAN CANO MARTINEZ Analista de Sistemas Cel: 300-782.48.44. WhatsApp: 300-782.48.44.

El jue, 13 de may. de 2021 a la(s) 12:33, ggreen86 escribió:

Yes, load the workbook and then make the changes and use the SaveWorkbookAs() method.


From: Lutz Scheffler @.***> Sent: Thursday, May 13, 2021 12:55 PM To: ggreen86/XLSX-Workbook-Class Cc: Subscribed Subject: [ggreen86/XLSX-Workbook-Class] Create Workbook from template (#47)

How to create a new workbook from template? Load the template and save ander different name or si there a different way?

TIA

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub< https://github.com/ggreen86/XLSX-Workbook-Class/issues/47>, or unsubscribe< https://github.com/notifications/unsubscribe-auth/AGWB33O4S5HYOL7XNAXZ5HTTNQAAXANCNFSM4424OF3A

.

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABMMTXPTYQNFGRPEOBDJUFTTNQEOHANCNFSM4424OF3A .

ggreen86 commented 3 years ago

Hernan--

That way should work. You can also open the template.xlsx file and then use the SaveWorkbookAs() method to save with the name "VENTAS_ENERO_2021.XLSx".

Please send me the template.xlsx file so that I can test with it to ensure it is being opened correctly and retaining the settings.

Thank you.

Greg


From: jhernancanom @.> Sent: Thursday, May 13, 2021 6:12 PM To: ggreen86/XLSX-Workbook-Class @.> Cc: ggreen86 @.>; Comment @.> Subject: Re: [ggreen86/XLSX-Workbook-Class] Create Workbook from template (#47)

Hi, Greg.

I am going to do it this way:

  1. From VFP, I use this sentence " copy TEMPLATE.XLSx to VENTAS_ENERO_2021.XLSx ".

  2. since XLSX-Workbook-Class I load VENTAS_ENERO_2021.XLSx, and....

  3. I make the changes I need.

  4. I use SaveWorkbook() method.

Is this a right way?

I need to confirm because with r31 I was receiving wrong results (in the way mentioned here) (hidden cols and hidden sheets appear visible, some formulas get out & stay values, several formats -bold, color-- disappear), and I am downloading last release to try.

Thanks.

HERNAN CANO MARTINEZ Analista de Sistemas Cel: 300-782.48.44. WhatsApp: 300-782.48.44.

El jue, 13 de may. de 2021 a la(s) 12:33, ggreen86 escribió:

Yes, load the workbook and then make the changes and use the SaveWorkbookAs() method.


From: Lutz Scheffler @.***> Sent: Thursday, May 13, 2021 12:55 PM To: ggreen86/XLSX-Workbook-Class Cc: Subscribed Subject: [ggreen86/XLSX-Workbook-Class] Create Workbook from template (#47)

How to create a new workbook from template? Load the template and save ander different name or si there a different way?

TIA

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub< https://github.com/ggreen86/XLSX-Workbook-Class/issues/47>, or unsubscribe< https://github.com/notifications/unsubscribe-auth/AGWB33O4S5HYOL7XNAXZ5HTTNQAAXANCNFSM4424OF3A

.

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABMMTXPTYQNFGRPEOBDJUFTTNQEOHANCNFSM4424OF3A .

— You are receiving this because you commented. Reply to this email directly, view it on GitHubhttps://github.com/ggreen86/XLSX-Workbook-Class/issues/47#issuecomment-840865311, or unsubscribehttps://github.com/notifications/unsubscribe-auth/AGWB33NRXY7D6HQ3FQGHX2DTNRFGRANCNFSM4424OF3A.

lscheffler commented 3 years ago

@ggreen86 , my problem was rather to load an XLST excel template instead to copy an XLSX. Scenario:

So the customer can create a kind of header I fill in, and sets for example the position of column names and where the data starts.

I know there are differences how EXCEL deals with XLST and XLSX, but I have no insight if this is internal to the file or something determined on how the file is opened.

ggreen86 commented 3 years ago

Can you send a copy of the XLST template file? I would like to look 'under the hood' to see what differences there are in it vs. the XLSX file. Possibly this can be added to the class with the other needs below.

Greg


From: Lutz Scheffler @.> Sent: Friday, May 14, 2021 11:03 AM To: ggreen86/XLSX-Workbook-Class @.> Cc: ggreen86 @.>; Mention @.> Subject: Re: [ggreen86/XLSX-Workbook-Class] Create Workbook from template (#47)

@ggreen86https://github.com/ggreen86 , my problem was rather to load an XLST excel template instead to copy an XLSX. Scenario:

So the customer can create a kind of header I fill in, and sets for example the position of column names and where the data starts.

I know there are differences how EXCEL deals with XLST and XLSX, but I have no insight if this is internal to the file or something determined on how the file is opened.

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHubhttps://github.com/ggreen86/XLSX-Workbook-Class/issues/47#issuecomment-841300061, or unsubscribehttps://github.com/notifications/unsubscribe-auth/AGWB33ML45IDDEVHA4PNB2LTNU3V7ANCNFSM4424OF3A.

lscheffler commented 3 years ago

Well, the simplest would be to create something on EXCEL and save as XLST? Possibly a file you have as XLSX, so you can compare? Anyway, see zip attached. It's nothing then some cells dedicated to receive data bound to there named cells.

Export.zip

lscheffler commented 3 years ago

Same as above, as xlsx and xltx Vorlagen.zip

ggreen86 commented 3 years ago

The file you sent is a xlt (not a xltx). It is the older format for the template file which is not supported (it is not an xml format that can be parsed).


From: Lutz Scheffler @.> Sent: Friday, May 14, 2021 2:17 PM To: ggreen86/XLSX-Workbook-Class @.> Cc: ggreen86 @.>; Mention @.> Subject: Re: [ggreen86/XLSX-Workbook-Class] Create Workbook from template (#47)

Well, the simplest would be to create something on EXCEL and save as XLST? Possibly a file you have as XLSX, so you can compare? Anyway, see zip attached. It's nothing then some cells dedicated to receive data bound to there named cells.

Export.ziphttps://github.com/ggreen86/XLSX-Workbook-Class/files/6480527/Export.zip

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHubhttps://github.com/ggreen86/XLSX-Workbook-Class/issues/47#issuecomment-841418728, or unsubscribehttps://github.com/notifications/unsubscribe-auth/AGWB33MQIPJOMEBZQREF5A3TNVSNFANCNFSM4424OF3A.

lscheffler commented 3 years ago

The file in the second message comes with xltx. As far as I see it's xml in a zip. I saw the error too ...