Quantcast
Channel: html2openxml Discussions Rss Feed
Viewing all articles
Browse latest Browse all 228

New Post: heading tag and font name changes are not applied to open xml document

$
0
0
Hi Baala,


For the headings in Bold, this is like that in the default theme of Word 2010. If you want to customize your headings, I can only propose you to open Word, set the theme as you need and then save your document.
Embed that document inside a resx and use it inside your code:
using (MemoryStream generatedDocument = new MemoryStream())
{
     byte[] data = Demo.Properties.Resources.template;
     generatedDocument.Write(data, 0, data.Length);
     generatedDocument.Position = 0L;
     using (WordprocessingDocument package = WordprocessingDocument.Open(generatedDocument, true))
     {
          ....
     }
}
For the inline style, at the time being, no style are supported. I will commit this feature soon but I need to finish other step.
But you can already now support text-align by adding this code in ProcessHeading:
List<OpenXmlElement> styleAttributes = new List<OpenXmlElement>();
htmlStyles.Paragraph.ProcessCommonAttributes(en, styleAttributes);

AlternateProcessHtmlChunks(en, "</h" + level + ">");
Paragraph p = new Paragraph(elements);
p.InsertInProperties(prop =>
                prop.ParagraphStyleId = new ParagraphStyleId() { Val = htmlStyles.GetStyle(clsName, StyleValues.Paragraph) });

htmlStyles.Paragraph.ApplyTags(p);
htmlStyles.Paragraph.EndTag("<h" + level + ">");

Viewing all articles
Browse latest Browse all 228

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>