When saving a file that has HTML content starting with a pre tag using Docx, the first line is duplicated.
Nobody has claimed this yet.
Assessment
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Newbie friendliness
- 48/100
Research direction
Start by reproducing the issue through DocX.InsertContent with the HTML snippet, comparing a self-closing br tag with the expanded form. Trace the HTML handling involved and add a regression test showing that content in the initial pre tag is not duplicated; done means both forms produce the expected document.
Written by the indexing model from the issue text.
Description
When saving HTML content to a file using Docx, it duplicates the first line if a break is inserted on the second line. Below is a code snippet example. The content in the pre tag will show in the file twice.
Imports Xceed.Document.NET
Imports Xceed.Words.NET
Dim sbHtmlContent As New StringBuilder
sbHtmlContent.Append("<pre>schema-version = 1.0.0</pre>")
sbHtmlContent.Append("<br/>")
sbHtmlContent.Append("<p>some other content<p/>")
Dim htmlContent = sbHtmlContent.ToString
Dim fullFileName As String = "pathtofile.doc"
Dim doc As Xceed.Words.NET.DocX = Xceed.Words.NET.DocX.Create(fullFileName)
doc.InsertContent(htmlContent, Xceed.Document.NET.ContentType.Html)
doc.Save()
UPDATE: This is happening because of the self closing tag. If I replace this
sbHtmlContent.Append("<br/>")
with this
sbHtmlContent.Append("<br></br>")
It doesn't duplicate the first line.
- Dominant language
- C#
- Stars
- 1.9k
- Forks
- 483
- PR merge metrics
- No merged PRs in 30d
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from xceedsoftware/DocX
-
Difficulty 4/5 3-5 days Newbie friendliness 35/100
xceedsoftware/DocX#488 · 1 comment · 1 reaction ·
-
keep format Open
Difficulty 3/5 1-2 days Newbie friendliness 25/100
xceedsoftware/DocX#487 · 3 comments ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 45/100
xceedsoftware/DocX#485 · 1 comment ·
-
Difficulty 4/5 3-5 days Newbie friendliness 25/100
xceedsoftware/DocX#482 · 4 comments ·
-
Difficulty 3/5 1-2 days Newbie friendliness 45/100
xceedsoftware/DocX#481 · 1 comment ·
All issues in xceedsoftware/DocX
Similar issues
-
type/automation type/tech-debt
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
-
bug
Difficulty 2/5 1-3 hours Newbie friendliness 88/100
-
t/bug
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
-
ci-failure-cause test-failure
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
-
area:auth FE mvp P3
Difficulty 2/5 1-3 hours Newbie friendliness 88/100
klasolsson81/jobbliggaren#1788 ·