[GH-ISSUE #478] Wrong images position on iPhone iOS 18.4 #375

Closed
opened 2026-05-05 12:13:14 -06:00 by gitea-mirror · 12 comments
Owner

Originally created by @RamboYao on GitHub (May 13, 2025).
Original GitHub issue: https://github.com/jmcnamara/libxlsxwriter/issues/478

Originally assigned to: @jmcnamara on GitHub.

libxlsxwriter Version: 1.1.4 and 1.2.2
iPhone: iOS18.4

I use lixxlsxwriter to export .xlsx excel within images on my application and use UIDocumentViewController to open it. Before iOS 18.4, the images position is correct, but on iOS18.4 the images position seem like has some problem and I have no idea how to fix it. I will appreciate if you can give some advice to solve it.

                lxw_image_options options = {.x_offset = 0, .y_offset = 0, .x_scale = scale ,.y_scale = 0.1, };
                worksheet_insert_image_opt(worksheet, (int)index + 1, 1, [imagePath UTF8String], &options);

Image

Originally created by @RamboYao on GitHub (May 13, 2025). Original GitHub issue: https://github.com/jmcnamara/libxlsxwriter/issues/478 Originally assigned to: @jmcnamara on GitHub. libxlsxwriter Version: 1.1.4 and 1.2.2 iPhone: iOS18.4 I use lixxlsxwriter to export .xlsx excel within images on my application and use UIDocumentViewController to open it. Before iOS 18.4, the images position is correct, but on iOS18.4 the images position seem like has some problem and I have no idea how to fix it. I will appreciate if you can give some advice to solve it. lxw_image_options options = {.x_offset = 0, .y_offset = 0, .x_scale = scale ,.y_scale = 0.1, }; worksheet_insert_image_opt(worksheet, (int)index + 1, 1, [imagePath UTF8String], &options); ![Image](https://github.com/user-attachments/assets/8c8edbc0-281a-480a-a70b-38ddcca667da)
gitea-mirror 2026-05-05 12:13:14 -06:00
Author
Owner

@jmcnamara commented on GitHub (May 13, 2025):

Libxlsxwriter uses the same image positioning as Excel and there are a lot of tests to verify that it works correctly. Could you try test with a file created in Excel (not with libxlsxwriter) and see if you get the same result? Let me the result.

Also, if you are positioning an image in a cell then the newer
worksheet_embed_image() method may give a better result if it is supported by UIDocumentViewController.

<!-- gh-comment-id:2875543948 --> @jmcnamara commented on GitHub (May 13, 2025): Libxlsxwriter uses the same image positioning as Excel and there are a lot of tests to verify that it works correctly. Could you try test with a file created in Excel (not with libxlsxwriter) and see if you get the same result? Let me the result. Also, if you are positioning an image in a cell then the newer [`worksheet_embed_image()`](https://libxlsxwriter.github.io/worksheet_8h.html#afaf00521027cd79c6d7d93537848b283) method may give a better result **if** it is supported by `UIDocumentViewController`.
Author
Owner

@RamboYao commented on GitHub (May 14, 2025):

I tested with a file created in Excel.
I preview the file on my Xcode, and open it on my app with UIDocumentInteractionController.

The first image is from Xcode,the second image is from my app.

Image

Image

<!-- gh-comment-id:2879344631 --> @RamboYao commented on GitHub (May 14, 2025): I tested with a file created in Excel. I preview the file on my Xcode, and open it on my app with UIDocumentInteractionController. The first image is from Xcode,the second image is from my app. ![Image](https://github.com/user-attachments/assets/58e0ad75-c72e-4a91-8353-6c8a842b8d00) ![Image](https://github.com/user-attachments/assets/045d5872-4275-475c-a90a-fd925f539dd3)
Author
Owner

@jmcnamara commented on GitHub (May 14, 2025):

Is the layout different in those images?

If so, please attach both files so I can test them.

<!-- gh-comment-id:2879475892 --> @jmcnamara commented on GitHub (May 14, 2025): Is the layout different in those images? If so, please attach both files so I can test them.
Author
Owner

@RamboYao commented on GitHub (May 15, 2025):

I didn't catch you very well.
This is the original excel file.
Also I will try to use work_sheet_embed_image() method to test it.
worksheet.xlsx

<!-- gh-comment-id:2881934349 --> @RamboYao commented on GitHub (May 15, 2025): I didn't catch you very well. This is the original excel file. Also I will try to use work_sheet_embed_image() method to test it. [worksheet.xlsx](https://github.com/user-attachments/files/20217762/worksheet.xlsx)
Author
Owner

@RamboYao commented on GitHub (May 15, 2025):

I tested worksheet_embed_image() method, but the image did not show in file.
I open it with Numbers app, and I can't see the images too.

<!-- gh-comment-id:2882668326 --> @RamboYao commented on GitHub (May 15, 2025): I tested worksheet_embed_image() method, but the image did not show in file. I open it with Numbers app, and I can't see the images too.
Author
Owner

@jmcnamara commented on GitHub (May 15, 2025):

I tested worksheet_embed_image() method, but the image did not show in file.
I open it with Numbers app, and I can't see the images too.

Embedded images are a new feature in Excel so they may not work yet in Numbers or UIDocumentViewController but it was worth checking.

<!-- gh-comment-id:2882828575 --> @jmcnamara commented on GitHub (May 15, 2025): > I tested worksheet_embed_image() method, but the image did not show in file. > I open it with Numbers app, and I can't see the images too. Embedded images are a new feature in Excel so they may not work yet in Numbers or `UIDocumentViewController ` but it was worth checking.
Author
Owner

@jmcnamara commented on GitHub (May 15, 2025):

Adding file for testing:

worksheet-2.xlsx

<!-- gh-comment-id:2882829949 --> @jmcnamara commented on GitHub (May 15, 2025): Adding file for testing: [worksheet-2.xlsx](https://github.com/user-attachments/files/20223721/worksheet-2.xlsx)
Author
Owner

@RamboYao commented on GitHub (May 15, 2025):

Image

<!-- gh-comment-id:2882855004 --> @RamboYao commented on GitHub (May 15, 2025): ![Image](https://github.com/user-attachments/assets/54a0e166-a381-4afa-a292-bfaa95778b10)
Author
Owner

@jmcnamara commented on GitHub (May 15, 2025):

Test file created in Excel 2007:

gh478_1.xlsx

<!-- gh-comment-id:2882879400 --> @jmcnamara commented on GitHub (May 15, 2025): Test file created in Excel 2007: [gh478_1.xlsx](https://github.com/user-attachments/files/20224241/gh478_1.xlsx)
Author
Owner

@RamboYao commented on GitHub (May 15, 2025):

1、Open by UIDocumentInteractionController

Image

2、Preview On Xcode:

Image

<!-- gh-comment-id:2882948213 --> @RamboYao commented on GitHub (May 15, 2025): 1、Open by UIDocumentInteractionController ![Image](https://github.com/user-attachments/assets/dc1dff3a-ab55-4b3f-99df-0834f9c7cacb) 2、Preview On Xcode: ![Image](https://github.com/user-attachments/assets/b57ef4b6-d330-4739-b4b5-59c55076a610)
Author
Owner

@jmcnamara commented on GitHub (May 15, 2025):

The test file gh478_1.xlsx was created in Excel 2007 for maximum backward compatibility and it shows the same offset issue. So this isn't a libxlsxwriter issue. It affects all files created by Excel.

Unfortunately, that means that there isn't anything that I can do to help you.

<!-- gh-comment-id:2882948264 --> @jmcnamara commented on GitHub (May 15, 2025): The test file `gh478_1.xlsx` was created in Excel 2007 for maximum backward compatibility and it shows the same offset issue. So this isn't a libxlsxwriter issue. It affects all files created by Excel. Unfortunately, that means that there isn't anything that I can do to help you.
Author
Owner

@RamboYao commented on GitHub (May 15, 2025):

Thanks For your time.

<!-- gh-comment-id:2882962741 --> @RamboYao commented on GitHub (May 15, 2025): Thanks For your time.
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#375
No description provided.