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

i cannot open a file with npoi #1339

Closed
1 task
weifan999 opened this issue May 7, 2024 · 5 comments
Closed
1 task

i cannot open a file with npoi #1339

weifan999 opened this issue May 7, 2024 · 5 comments
Labels

Comments

@weifan999
Copy link

NPOI Version

2.7.0

File Type

  • XLSX

using var fs = new FileStream(filename, FileMode.Open, FileAccess.ReadWrite, FileShare.None);
IWorkbook wb = new XSSFWorkbook(fs);

When I execute the second sentence, the following error occurs:
QQ图片20240507123138

When I open the workbook and do nothing and click save, an error occurs when I execute the above code. When I deleted all the blank lines below, it returned to normal.

@weifan999 weifan999 added the bug label May 7, 2024
@tonyqus
Copy link
Member

tonyqus commented May 7, 2024

Please provide the xlsx file.

@weifan999
Copy link
Author

here are the file
合约台账 - 副本.xlsx

@tonyqus
Copy link
Member

tonyqus commented May 8, 2024

In styles.xml, there are two tableStyle with same name 'TableStylePreset3_Accent1'. There is nothing wrong with NPOI exception. Please double check your file.

	<tableStyles count="3" defaultTableStyle="TableStylePreset3_Accent1" defaultPivotStyle="PivotStylePreset2_Accent1">
		<tableStyle name="TableStylePreset3_Accent1" pivot="0" count="7" xr9:uid="{59DB682C-5494-4EDE-A608-00C9E5F0F923}">
			<tableStyleElement type="wholeTable" dxfId="6"/>
			<tableStyleElement type="headerRow" dxfId="5"/>
			<tableStyleElement type="totalRow" dxfId="4"/>
			<tableStyleElement type="firstColumn" dxfId="3"/>
			<tableStyleElement type="lastColumn" dxfId="2"/>
			<tableStyleElement type="firstRowStripe" dxfId="1"/>
			<tableStyleElement type="firstColumnStripe" dxfId="0"/>
		</tableStyle>
		<tableStyle name="TableStylePreset3_Accent1" pivot="0" table="0" count="7" xr9:uid="{709FE4E6-EA37-494D-900A-CBBD63CA84A4}">
			<tableStyleElement type="wholeTable" dxfId="6"/>
			<tableStyleElement type="headerRow" dxfId="5"/>
			<tableStyleElement type="totalRow" dxfId="4"/>
			<tableStyleElement type="firstColumn" dxfId="3"/>
			<tableStyleElement type="lastColumn" dxfId="2"/>
			<tableStyleElement type="firstRowStripe" dxfId="1"/>
			<tableStyleElement type="firstColumnStripe" dxfId="0"/>
		</tableStyle>
		<tableStyle name="PivotStylePreset2_Accent1" table="0" count="10" xr9:uid="{267968C8-6FFD-4C36-ACC1-9EA1FD1885CA}">
			<tableStyleElement type="headerRow" dxfId="22"/>
			<tableStyleElement type="totalRow" dxfId="21"/>
			<tableStyleElement type="firstRowStripe" dxfId="20"/>
			<tableStyleElement type="firstColumnStripe" dxfId="19"/>
			<tableStyleElement type="firstSubtotalRow" dxfId="18"/>
			<tableStyleElement type="secondSubtotalRow" dxfId="17"/>
			<tableStyleElement type="firstRowSubheading" dxfId="16"/>
			<tableStyleElement type="secondRowSubheading" dxfId="15"/>
			<tableStyleElement type="pageFieldLabels" dxfId="14"/>
			<tableStyleElement type="pageFieldValues" dxfId="13"/>
		</tableStyle>
	</tableStyles>

@weifan999
Copy link
Author

I modified the style.xml of the file, and the code runs normally. However, when I open the xlsx file, nothing is done. After clicking Save, this error will appear again when executing NPOI.

@weifan999
Copy link
Author

It's very strange, so I mentioned it at the beginning, to open a worksheet, do nothing, just click save, and then close. An error will be reported when executing npoi code

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

No branches or pull requests

2 participants