-
Notifications
You must be signed in to change notification settings - Fork 47
Open
Description
When a paragraph is added to a cell the text is also created outside the table as a separate paragraph.
XWPFDocument document = null;
var parList = new List<XWPFParagraph>();
try
{
using (FileStream file = new FileStream("C:\\Temp\\TechSpec_Documentation.docx", FileMode.Open, FileAccess.Read))
{
document = new XWPFDocument(file);
foreach (var paragraph in document.Paragraphs)
{
var par = paragraph.Style;
if (paragraph.Style == "Heading1")
{
parList.Add(paragraph);
}
}
}
}
catch (Exception e)
{
}
XWPFParagraph p1 = document.CreateParagraph();
XWPFRun r3 = p1.CreateRun();
r3.IsBold= true;
r3.SetText("The quick brown fox");
r3.IsBold= true;
r3.SetFontFamily("Courier", FontCharRange.Ascii);
r3.SetUnderline(UnderlinePatterns.DotDotDash);
r3.SetTextPosition(100);
table1.GetRow(0).GetCell(0).SetParagraph(p1);
var sw = new FileStream("C:\\Temp\\TechSpec_ReleaseDocumentation2.docx", FileMode.Create);
table1.GetRow(2).GetCell(2).SetText("only text");
document.Write(sw);
sw.Close();
Is there something changed as in the example files this the way shown to add a paragraph to a table cell.
Metadata
Metadata
Assignees
Labels
No labels