[GH-ISSUE #371] We found a problem with some content #297

Closed
opened 2026-05-05 12:06:58 -06:00 by gitea-mirror · 8 comments
Owner

Originally created by @willm132 on GitHub (May 3, 2022).
Original GitHub issue: https://github.com/jmcnamara/libxlsxwriter/issues/371

Using Swift and Xcode

Once you open the document you get this error

Screen Shot 2022-05-03 at 1 26 20 PM Screen Shot 2022-05-03 at 1 26 26 PM Screen Shot 2022-05-03 at 1 26 48 PM
Originally created by @willm132 on GitHub (May 3, 2022). Original GitHub issue: https://github.com/jmcnamara/libxlsxwriter/issues/371 Using Swift and Xcode Once you open the document you get this error <img width="224" alt="Screen Shot 2022-05-03 at 1 26 20 PM" src="https://user-images.githubusercontent.com/47162632/166506618-0efa3173-c044-4d4c-8af2-5623a3d40291.png"> <img width="235" alt="Screen Shot 2022-05-03 at 1 26 26 PM" src="https://user-images.githubusercontent.com/47162632/166506625-8ce8cc2d-1595-4128-a54b-624a6a1ba75e.png"> <img width="760" alt="Screen Shot 2022-05-03 at 1 26 48 PM" src="https://user-images.githubusercontent.com/47162632/166506631-329a1331-7cc7-4c8f-80a9-e9f9694824cb.png">
Author
Owner

@jmcnamara commented on GitHub (May 3, 2022):

Like you add a complete sample application that demonstrates the issue.

<!-- gh-comment-id:1116359505 --> @jmcnamara commented on GitHub (May 3, 2022): Like you add a complete sample application that demonstrates the issue.
Author
Owner

@willm132 commented on GitHub (May 3, 2022):

 let workbook = workbook_new(formatURLForIOS)
 let worksheet1 = workbook_add_worksheet(workbook, "\(fileName)")
worksheet_center_horizontally(worksheet1)

let standardText = workbook_add_format(workbook)
format_set_font_name(standardText, SETTINGS.reportFont)

let boldTextCustShipLoc = workbook_add_format(workbook)
format_set_font_name(boldTextCustShipLoc, SETTINGS.reportFont)

format_set_text_wrap(standardText)
format_set_text_wrap(boldTextCustShipLoc)

worksheet_merge_range(worksheet1, lxw_row_t(currentRow), 0, lxw_row_t(currentRow), lxw_col_t(totalLength), 
"Generated On: \(SETTINGS.fullDateAndTime) ", boldTextCustShipLoc)
currentRow += 1

worksheet_fit_to_pages(worksheet1, 1, 0)
workbook_close(workbook)
<!-- gh-comment-id:1116372366 --> @willm132 commented on GitHub (May 3, 2022): ``` let workbook = workbook_new(formatURLForIOS) let worksheet1 = workbook_add_worksheet(workbook, "\(fileName)") worksheet_center_horizontally(worksheet1) let standardText = workbook_add_format(workbook) format_set_font_name(standardText, SETTINGS.reportFont) let boldTextCustShipLoc = workbook_add_format(workbook) format_set_font_name(boldTextCustShipLoc, SETTINGS.reportFont) format_set_text_wrap(standardText) format_set_text_wrap(boldTextCustShipLoc) worksheet_merge_range(worksheet1, lxw_row_t(currentRow), 0, lxw_row_t(currentRow), lxw_col_t(totalLength), "Generated On: \(SETTINGS.fullDateAndTime) ", boldTextCustShipLoc) currentRow += 1 worksheet_fit_to_pages(worksheet1, 1, 0) workbook_close(workbook) ```
Author
Owner

@jmcnamara commented on GitHub (May 3, 2022):

Thanks. Could you also attach the output xlsx file.

<!-- gh-comment-id:1116375850 --> @jmcnamara commented on GitHub (May 3, 2022): Thanks. Could you also attach the output xlsx file.
Author
Owner

@willm132 commented on GitHub (May 3, 2022):

Also, worksheet_repeat_rows(worksheet1, 5, 5) does nothing when you open with excel and try to print

<!-- gh-comment-id:1116379815 --> @willm132 commented on GitHub (May 3, 2022): Also, worksheet_repeat_rows(worksheet1, 5, 5) does nothing when you open with excel and try to print
Author
Owner

@jmcnamara commented on GitHub (May 3, 2022):

Sorry, I meant could you attach the xlsx file from the smaller sample program above.

<!-- gh-comment-id:1116413252 --> @jmcnamara commented on GitHub (May 3, 2022): Sorry, I meant could you attach the xlsx file from the smaller sample program above.
Author
Owner

@jmcnamara commented on GitHub (May 4, 2022):

The reason for this Excel error is that there are overlapping merged ranges. Specifically "A97:C97" and "A97:I97".

Libxlsxwriter should warn/prevent overlapping ranges (and it is a planned feature https://github.com/jmcnamara/XlsxWriter/issues/848) but for now try to avoid overlapping merged ranges.

<!-- gh-comment-id:1117056200 --> @jmcnamara commented on GitHub (May 4, 2022): The reason for this Excel error is that there are overlapping merged ranges. Specifically "A97:C97" and "A97:I97". Libxlsxwriter should warn/prevent overlapping ranges (and it is a planned feature https://github.com/jmcnamara/XlsxWriter/issues/848) but for now try to avoid overlapping merged ranges.
Author
Owner

@willm132 commented on GitHub (May 4, 2022):

And why does the worksheet_repeat_rows(worksheet1, 5, 5) do nothing when opening in excel?

<!-- gh-comment-id:1117215620 --> @willm132 commented on GitHub (May 4, 2022): And why does the worksheet_repeat_rows(worksheet1, 5, 5) do nothing when opening in excel?
Author
Owner

@jmcnamara commented on GitHub (May 4, 2022):

And why does the worksheet_repeat_rows(worksheet1, 5, 5) do nothing when opening in excel?

It should work. Here is a C example:

#include "xlsxwriter.h"

int main() {

    lxw_workbook  *workbook  = workbook_new("test_repeat.xlsx");
    lxw_worksheet *worksheet = workbook_add_worksheet(workbook, "Sheet 1");

    worksheet_repeat_rows(worksheet, 5, 5);

    worksheet_write_string(worksheet, CELL("A1"), "Foo" , NULL);

    return workbook_close(workbook);
}

Output:

Screenshot 2022-05-04 at 15 32 11

However, if you are using xlsxwriter.swift then it may not be supported/ported. I don't see it mentioned in the code.

<!-- gh-comment-id:1117403287 --> @jmcnamara commented on GitHub (May 4, 2022): > And why does the worksheet_repeat_rows(worksheet1, 5, 5) do nothing when opening in excel? It should work. Here is a C example: ```C #include "xlsxwriter.h" int main() { lxw_workbook *workbook = workbook_new("test_repeat.xlsx"); lxw_worksheet *worksheet = workbook_add_worksheet(workbook, "Sheet 1"); worksheet_repeat_rows(worksheet, 5, 5); worksheet_write_string(worksheet, CELL("A1"), "Foo" , NULL); return workbook_close(workbook); } ``` **Output**: ![Screenshot 2022-05-04 at 15 32 11](https://user-images.githubusercontent.com/94267/166704715-f84e03b8-0c36-428a-b14b-7125aa1cff73.png) However, if you are using xlsxwriter.swift then it may not be supported/ported. I don't see it mentioned in the code.
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#297
No description provided.