Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature request: Add support for quotePrefix #385

Closed
stenvaag opened this issue Nov 28, 2022 · 2 comments
Closed

Feature request: Add support for quotePrefix #385

stenvaag opened this issue Nov 28, 2022 · 2 comments

Comments

@stenvaag
Copy link

stenvaag commented Nov 28, 2022

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

@jmcnamara
Copy link
Owner

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

@jmcnamara
Copy link
Owner

Add on main.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants