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

Corrupted file with AlternateContent #1196

Closed
jackson-bleechmore opened this issue Apr 4, 2022 · 6 comments
Closed

Corrupted file with AlternateContent #1196

jackson-bleechmore opened this issue Apr 4, 2022 · 6 comments
Labels
confirmed This issue can be reproduced

Comments

@jackson-bleechmore
Copy link

Hi there,

I have a file with an AlternateContent section in the worksheet XML, which is related to a Developer button.

When this is opened/written to a file (without making any changes) by Excelize commit d9b5afc, it cannot be opened by Excel (v16.59, macOS 12.1) (button_d9b5afc1ac4e.xlsx).

However, when doing the same thing with the Excelize released version (2.5.0) the file is not corrupted, and opens fine (button_2.5.0.xlsx).

When comparing the 2 outputted files XML worksheets the only difference is the file created using d9b5afc commit has the AlternateContent section preserved at the end of the file.

The original file (button.xlsx) has the AlternateContent section midway through.

Sounds like what was implemented in this commit f0cb29c

See the AlternateContent XML section below:
<mc:AlternateContent xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"> <mc:Choice Requires="x14"> <controls> <mc:AlternateContent xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"> <mc:Choice Requires="x14"> <control shapeId="1025" r:id="rId4" name="Button 1"> <controlPr defaultSize="0" print="0" autoFill="0" autoPict="0"> <anchor moveWithCells="1" sizeWithCells="1"> <from> <xdr:col>0</xdr:col> <xdr:colOff>635000</xdr:colOff> <xdr:row>0</xdr:row> <xdr:rowOff>25400</xdr:rowOff> </from> <to> <xdr:col>2</xdr:col> <xdr:colOff>12700</xdr:colOff> <xdr:row>0</xdr:row> <xdr:rowOff>215900</xdr:rowOff> </to> </anchor> </controlPr> </control> </mc:Choice> </mc:AlternateContent> </controls> </mc:Choice> </mc:AlternateContent>

Thanks in advance for your help, hopefully this can be fixed so we can make use of some of the new features implemented.

Cheers,
Jackson

@xuri xuri added the confirmed This issue can be reproduced label Apr 4, 2022
@xuri xuri closed this as completed in 26174a2 Apr 4, 2022
@xuri
Copy link
Member

xuri commented Apr 4, 2022

Thanks for your issue. I have fixed this issue. Please try upgrade to the master branch code.

@anguskeatinge
Copy link

You're a hero @xuri !

@jackson-bleechmore
Copy link
Author

Hi Xuri, we are using Excelize to edit Third Party spreadsheets and this is working for the example above, but with the latest commit some other ones are breaking - release 2.5.0 was working for all of them.

I'll narrow down an example of something in these spreadsheets that is causing the file to be corrupted when opened/written by Excelize.

@jackson-bleechmore
Copy link
Author

Hi Xuri if we take the original file button.xlsx, and open/write the file with Excelize it works.

However, if we take this original file and Protect the Workbook button_locked.xlsx (password: Test) and open/write it with the master branch 26174a2 of Excelize it will be corrupted button_locked_latest.xlsx, in the released 2.5.0 version this does happen button_locked_2.5.0.xlsx.

There is an AlternateContent section in xl/workbook.xml. This remains in the master branch excelize, and is removed in the release version. This section is below:

<mc:AlternateContent xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"> <mc:Choice Requires="x15"> <x15ac:absPath url="/Users/Jackson/Path/To/..." xmlns:x15ac="http://schemas.microsoft.com/office/spreadsheetml/2010/11/ac"/> </mc:Choice> </mc:AlternateContent>

It's interesting that deleting the AlternateContent section hasn't had any noticeable impacts.

Thanks again,
Jackson

@xuri xuri added the in progress Working in progress label Apr 5, 2022
xuri added a commit that referenced this issue Apr 5, 2022
…ction

- New formula functions: MODE and T.TEST
@xuri
Copy link
Member

xuri commented Apr 5, 2022

Thanks for your feedback. This issue was caused by incorrect fields order in the workbook, and I have fixed it. Please upgrade to the master branch code again.

@xuri xuri removed the in progress Working in progress label Apr 5, 2022
@jackson-bleechmore
Copy link
Author

Awesome, tested it out. It's now working for all the spreadsheets we're editing.

Thanks again

xuri added a commit to carbin-gun/excelize that referenced this issue Oct 9, 2022
…rmula function

ref qax-os#65, new formula functions: TINV and TTEST
xuri added a commit to carbin-gun/excelize that referenced this issue Oct 9, 2022
… formula function

- New formula functions: MODE and T.TEST
xuri added a commit to JDavidVR/excelize that referenced this issue Jul 11, 2023
…rmula function

ref qax-os#65, new formula functions: TINV and TTEST
xuri added a commit to JDavidVR/excelize that referenced this issue Jul 11, 2023
… formula function

- New formula functions: MODE and T.TEST
jenbonzhang pushed a commit to jenbonzhang/excelize that referenced this issue Oct 22, 2023
…rmula function

ref qax-os#65, new formula functions: TINV and TTEST
jenbonzhang pushed a commit to jenbonzhang/excelize that referenced this issue Oct 22, 2023
… formula function

- New formula functions: MODE and T.TEST
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
confirmed This issue can be reproduced
Projects
None yet
Development

No branches or pull requests

3 participants