AddAlternativeFormatImportPart - AlternativeFormatImportPartType.Html = generate empty line
See original GitHub issueI have the following method to add an HTML content
public static void AddHtml(this Paragraph paragraph, WordprocessingDocument doc, string content)
{
var ms = new MemoryStream(new UTF8Encoding(true).GetPreamble().Concat(Encoding.UTF8.GetBytes($"<html>{content}</html>")).ToArray());
string altChunkId = "div_" + new Random().Next(int.MinValue, int.MaxValue);
var part = doc.MainDocumentPart.AddAlternativeFormatImportPart(AlternativeFormatImportPartType.Html, altChunkId);
part.FeedData(ms);
paragraph.Append(new Run(new AltChunk { Id = altChunkId }));
}
however it is always generating an extra line right after the HTML content
Issue Analytics
- State:
- Created 2 years ago
- Comments:14
Top Results From Across the Web
AlternativeFormatImportPartType.Html = generate empty ...
I have the following method to add an HTML content public static void AddHtml(this Paragraph paragraph, WordprocessingDocument doc, string content) { var ms ......
Read more >C# Open XML HTML to DOCX Spacing
AddAlternativeFormatImportPart (AlternativeFormatImportPartType.Html ... (This prevents an empty First Line) mainDocumenPart.Document.Body.
Read more >I need to add a style in a word document by creating ...
I am creating a word doc with below code:- private void OpenWordDocument(DataTable dataTable, string xlsxFilePath, string xlsxReportTitle, ...
Read more >Convert HTML string from database to Word document ...
I am working on a project in asp.net with c#. I take data from mysql database in html format but I need to...
Read more >html to Word Document Converter using Open XML SDK
AddAlternativeFormatImportPart (AlternativeFormatImportPartType.Html, altChunkId); using (Stream chunkStream = chunk.GetStream(FileMode.
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
yes
was not it. I had to add to body before changing the paragraph.