[GH-ISSUE #326] Adjust Cell Width in Xcode #263

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

Originally created by @willm132 on GitHub (Apr 20, 2021).
Original GitHub issue: https://github.com/jmcnamara/libxlsxwriter/issues/326

Originally assigned to: @jmcnamara on GitHub.

I just got this working in my iOS app and it works great, the only issue I am running into is setting the cell width.

I am using this code:

let cellWidth = 25.0
let row = 0
let column = 0
worksheet_set_column(worksheet1, row, column, cellWidth, standardText)

and I have changed 25 to other numbers but the cell width is not changing once the document is created.

Originally created by @willm132 on GitHub (Apr 20, 2021). Original GitHub issue: https://github.com/jmcnamara/libxlsxwriter/issues/326 Originally assigned to: @jmcnamara on GitHub. I just got this working in my iOS app and it works great, the only issue I am running into is setting the cell width. I am using this code: let cellWidth = 25.0 let row = 0 let column = 0 worksheet_set_column(worksheet1, row, column, cellWidth, standardText) and I have changed 25 to other numbers but the cell width is not changing once the document is created.
gitea-mirror 2026-05-05 12:03:27 -06:00
Author
Owner

@jmcnamara commented on GitHub (Apr 21, 2021):

I just got this working in my iOS app and it works great

Cool. Does that mean I can close the Swift Package Manager request?

the only issue I am running into is setting the cell width.

I don't know what is happening. Unfortunately I don't use Swift (or Xcode very much) but the equivalent C program works fine:

#include "xlsxwriter.h"

int main() {

    /* Create a workbook and add a worksheet. */
    lxw_workbook  *workbook  = workbook_new("test.xlsx");
    lxw_worksheet *worksheet = workbook_add_worksheet(workbook, NULL);

    /* Adjust the column width. */
    worksheet_set_column(worksheet, 0, 0, 25, NULL);

    return workbook_close(workbook);
}

Output:

screenshot

Note, the syntax of worksheet_set_column() is (column, column) not (row, column), although in your case they are both 0 so that isn't the issue.

John

<!-- gh-comment-id:823946262 --> @jmcnamara commented on GitHub (Apr 21, 2021): > I just got this working in my iOS app and it works great Cool. Does that mean I can close the Swift Package Manager request? > the only issue I am running into is setting the cell width. I don't know what is happening. Unfortunately I don't use Swift (or Xcode very much) but the equivalent C program works fine: ```C #include "xlsxwriter.h" int main() { /* Create a workbook and add a worksheet. */ lxw_workbook *workbook = workbook_new("test.xlsx"); lxw_worksheet *worksheet = workbook_add_worksheet(workbook, NULL); /* Adjust the column width. */ worksheet_set_column(worksheet, 0, 0, 25, NULL); return workbook_close(workbook); } ``` Output: ![screenshot](https://user-images.githubusercontent.com/94267/115536422-ae1c9b00-a291-11eb-8f3a-11b2d8fd2094.png) Note, the syntax of [worksheet_set_column()](https://libxlsxwriter.github.io/worksheet_8h.html#a9656e4e05d3787eee6b3e4d8e82d9b7f) is (column, column) not (row, column), although in your case they are both 0 so that isn't the issue. John
Author
Owner

@willm132 commented on GitHub (Apr 21, 2021):

Yes you may close them

<!-- gh-comment-id:824010861 --> @willm132 commented on GitHub (Apr 21, 2021): Yes you may close them
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#263
No description provided.