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

New Post: Applying paragraph styles to cells in table.

$
0
0
Sure. I am still figuring out how to use this site, I will try to make my code available for the table style. If I can't do that for some reason, all I did was add the following to HtmlConverter.ProcessTag.ProcessTable:
string classValue = en.Attributes["class"];
if (classValue != null)
{
     properties.Add(new TableStyle() { Val = htmlStyles.GetStyle(classValue, StyleValues.Table, false) });
}
I placed it right before this line:
string align = en.Attributes["align"];
As for the spacing in Word 2010, there's two ways that can be done. The first is to highlight the cells in the table and manually select a paragraph style that you have defined to have no line spacing. The second is to highlight the cells and select the "Line and Paragraph Spacing" button in the "Paragraph" section of the home ribbon. I'm still learning how work with OpenXml itself, but since table cells need to have a paragraph in them, I am assuming that they get assigned "Normal" as a style if no other style is defined for them. If I change my "Normal" style to not have spacing in it, then the spacing in the cells disappear. However, that upsets all of the other formatting I have in place for the paragraphs outside the table, and it's more difficult for me to control those styles.

Viewing all articles
Browse latest Browse all 228

Trending Articles



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