jmcnamara / libxlsxwriter

A C library for creating Excel XLSX files.
https://libxlsxwriter.github.io
Other
1.51k stars 333 forks source link

worksheet name #314

Closed alimat-nz closed 3 years ago

alimat-nz commented 3 years ago

not sure if I am missing this in the documentation, or if this is a feature request.

I have recently installed libxlswriter, and using it from C I can not find how to rename a worksheet. When a new sheet is created it is sheet 1 2 3 etc as per the default in Excel. There is the ability to set a vbaname, but i can not see one that renames the sheet name that is displayed in excel, as is done when you right click and select rename, or double click on the worksheet name when in the excel application. Am I simply not finding the right function or should this be a feature request?

Thanks

jmcnamara commented 3 years ago

You can only set the name of the sheet when you create it. From the docs for workbook_add_worksheet():

The sheetname parameter is optional. If it is NULL the default Excel convention will be followed, i.e. Sheet1, Sheet2, etc.:

worksheet = workbook_add_worksheet(workbook, NULL  );     // Sheet1
worksheet = workbook_add_worksheet(workbook, "Foglio2");  // Foglio2
worksheet = workbook_add_worksheet(workbook, "Data");     // Data
worksheet = workbook_add_worksheet(workbook, NULL  );     // Sheet4

The name is used internally in a number of places so it intentionally can't be reset via the API.

alimat-nz commented 3 years ago

Thanks - as i said - I guess I missed it - thanks for the quick reply and an excellent bit of software! Alistair Matthewamatthew@nz1.ibm.com    ----- Original message -----From: John McNamara notifications@github.comTo: jmcnamara/libxlsxwriter libxlsxwriter@noreply.github.comCc: alimat-nz amatthew@nz1.ibm.com, Author author@noreply.github.comSubject: [EXTERNAL] Re: [jmcnamara/libxlsxwriter] worksheet name (#314)Date: Wed, Nov 11, 2020 10:41 AM    Closed #314. —You are receiving this because you authored the thread.Reply to this email directly, view it on GitHub, or unsubscribe.