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

Failed to open word file(.docx) when Text box on header or footer #1067

Closed
sjhank opened this issue Apr 20, 2023 · 2 comments
Closed

Failed to open word file(.docx) when Text box on header or footer #1067

sjhank opened this issue Apr 20, 2023 · 2 comments
Labels
bug docx file_error file format generation/writing issue
Milestone

Comments

@sjhank
Copy link

sjhank commented Apr 20, 2023

When I try to read the word(.docx) template file which has text box on header (or footer) and output the document file. Word will pop up windows about "Word found unreadable content in xxx.xlsx" when I open the output file.

Here is program:

var templatePath = @".\Template.docx";
var outputPath = @".\Output.docx";

using var templateFileStream = new FileStream(templatePath, FileMode.Open, FileAccess.Read);
var doc = new XWPFDocument(templateFileStream);

using (var outputFileStream = new FileStream(outputPath, FileMode.Create))
{
    doc.Write(outputFileStream);
}

Here is template file:
Template.docx

@tonyqus
Copy link
Member

tonyqus commented Aug 11, 2023

I can reproduce the issue

@tonyqus tonyqus added this to the NPOI 2.7.0 milestone Aug 11, 2023
@tonyqus tonyqus added bug file_error file format generation/writing issue and removed need-investigation labels Aug 11, 2023
@tonyqus
Copy link
Member

tonyqus commented Aug 11, 2023

header1.xml is lack of a few w16 prefix xml namespace and this Word file is using Microsoft Office 16.0 features.

@tonyqus tonyqus modified the milestones: NPOI 2.7.0, NPOI 2.6.2 Aug 23, 2023
tonyqus added a commit that referenced this issue Aug 23, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug docx file_error file format generation/writing issue
Projects
None yet
Development

No branches or pull requests

2 participants