Hi!
There is a question: how to substitute following code with use object builder.InsertParagraph();
…etc.
In other words is it possible to build word tables by means ASPOSE Paragraph object with rich (the same) Formatting features as (in the code below) ASPOSE Table does?
As a result, please, see attached picture.
Could you clarify exactly what you mean? From what I understand you want to insert rich text into a cell by making the table out of paragraphs instead? You can instead simply insert paragraphs and change font for each cell. See the code below which shows you how to achieve this:
Cell currentCell = builder.InsertCell();
Run run = new Run(doc, "Text");
run.Font.Bold = true;
Paragraph para = new Paragraph(doc);
para.AppendChild(run);
currentCell.AppendChild(para);
If this is not what you are trying to do could you provide an example of what you are trying to achieve?
Do you mean you are inserting text into an existing table? If so then you can still attach a new run and paragraph to the table which will give you the formatting you want. Could you please attach your template here and a snippet of the code your using? We can take a look and suggest a method that will work for you.
Table table = doc.Sections[0].Body.Tables[0];
Run runID = new Run(doc, tbl.Rows[i][j].ToString());
table.Rows[0].Cells[0].FirstParagraph.AppendChild(runID);
All attachments can only be opened by Aspose staff so your document will be kept private.
No, everything much simpler in my case
“ReportBuilder.docx” I use/load as template, but it’s just absolutely empty Microsoft Word document
Document doc = new Document(System.IO.Path.Combine(sPathToReportBuilderWordTemplate, "ReportBuilder.docx"));
DocumentBuilder builder = new DocumentBuilder(doc);
builder.StartTable(); // I need to get rid of that and use instead Paragraph object
builder.InsertCell();
...
builder.Write("something");
builder.EndRow(); // I need to get rid of that and use instead Paragraph object
builder.EndTable(); // I need to get rid of that and use instead Paragraph object
How I’m building table and how that table looks like, please see at my first post.
But if I use Paragraph object I need the same formatting
Could you explain a little further excatly what you’re trying to achieve? It sounds to me like you just want to insert the text into new paragraphs with custom formatting but still have it look like a table? Why can’t you use the table as how you have it now and insert the text into new paragraphs inside the table?
Hopefully answering these will clear this up and I can give you some suggestions.
I understand that now it may be simpler for me to build tables by means Aspose words tables objects, but I’m just asking (repeating the question in first post):
if it possible to do that only by means Aspose Paragraphs objects ? (if yes - show please ‘how’)
I presume that in future I’ll benefit from using Paragraph object in comparison with Aspose table object for building Aspose word report (having in hands much richer Aspose features to build word report) - is that all true or not???
Thank you for additional information. Actually, you should note that table actually consist of rows containing cells containing paragraphs. Please see Aspose.Words Document Object Model to learn more: