[GH-ISSUE #385] Feature request: Add support for quotePrefix #309

Closed
opened 2026-05-05 12:07:57 -06:00 by gitea-mirror · 2 comments
Owner

Originally created by @stenvaag on GitHub (Nov 28, 2022).
Original GitHub issue: https://github.com/jmcnamara/libxlsxwriter/issues/385

Originally assigned to: @jmcnamara on GitHub.

Greetings,

I am using libxlsxwriter to create a spreadsheet equal to an old one I have.

The old spreadsheet uses the equal sign in the beginning of a string. To avoid evaluation when selecting this cell for editiing in Excel I need the quotePrefix attribute.

Here is some code that demonstrates the problem:

#include "xlsxwriter.h"
int main() {
    lxw_workbook  *workbook  = workbook_new("quoteprefix.xlsx");
    lxw_worksheet *worksheet = workbook_add_worksheet(workbook, NULL);
    worksheet_write_string(worksheet, 0, 0, "= Hello", NULL);
    return workbook_close(workbook);
}

Opening the quoteprefix.xlsx in Excel and start editing the cell and press just press Enter, the cell content changes to #NAME?.

After patch

#include "xlsxwriter.h"
int main() {
    lxw_workbook  *workbook  = workbook_new("quoteprefix.xlsx");
    lxw_format *quote = workbook_add_format(workbook);
    format_set_quote_prefix(quote);
    lxw_worksheet *worksheet = workbook_add_worksheet(workbook, NULL);
    worksheet_write_string(worksheet, 0, 0, "= Hello", quote);
    return workbook_close(workbook);
}

A patch is attached.
libxlsxwriter-quote_prefix.txt

Originally created by @stenvaag on GitHub (Nov 28, 2022). Original GitHub issue: https://github.com/jmcnamara/libxlsxwriter/issues/385 Originally assigned to: @jmcnamara on GitHub. Greetings, I am using libxlsxwriter to create a spreadsheet equal to an old one I have. The old spreadsheet uses the equal sign in the beginning of a string. To avoid evaluation when selecting this cell for editiing in Excel I need the quotePrefix attribute. Here is some code that demonstrates the problem: ```C #include "xlsxwriter.h" int main() { lxw_workbook *workbook = workbook_new("quoteprefix.xlsx"); lxw_worksheet *worksheet = workbook_add_worksheet(workbook, NULL); worksheet_write_string(worksheet, 0, 0, "= Hello", NULL); return workbook_close(workbook); } ``` Opening the quoteprefix.xlsx in Excel and start editing the cell and press just press Enter, the cell content changes to #NAME?. After patch ```C #include "xlsxwriter.h" int main() { lxw_workbook *workbook = workbook_new("quoteprefix.xlsx"); lxw_format *quote = workbook_add_format(workbook); format_set_quote_prefix(quote); lxw_worksheet *worksheet = workbook_add_worksheet(workbook, NULL); worksheet_write_string(worksheet, 0, 0, "= Hello", quote); return workbook_close(workbook); } ``` A patch is attached. [libxlsxwriter-quote_prefix.txt](https://github.com/jmcnamara/libxlsxwriter/files/10103226/libxlsxwriter-quote_prefix.txt)
gitea-mirror 2026-05-05 12:07:57 -06:00
Author
Owner

@jmcnamara commented on GitHub (Nov 28, 2022):

Sure, I can look at that for the next release.

<!-- gh-comment-id:1328970000 --> @jmcnamara commented on GitHub (Nov 28, 2022): Sure, I can look at that for the next release.
Author
Owner

@jmcnamara commented on GitHub (Jan 10, 2023):

Add on main.

<!-- gh-comment-id:1376519594 --> @jmcnamara commented on GitHub (Jan 10, 2023): Add on main.
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference: github-starred/libxlsxwriter#309
No description provided.