Hi,
Thanks for your inquiry and sorry for the delayed response.
Please note that Aspose.Words represents the document as a tree of objects like an XML DOM tree. Please read the following articles for more information on DOM:
https://docs.aspose.com/words/net/aspose-words-document-object-model/
https://docs.aspose.com/words/net/logical-levels-of-nodes-in-a-document/
lovecomputer:
I have a text:“1 test title A”
“2 test title B”
I want delete “1” and “2”,What do I need to do?
All text of the document is stored in runs of text. Please use Run.Text Property to get or set the text of the run.
// Create an empty document. It contains one empty paragraph.
Document doc = new Document();
// Create a new run of text.
Run run = new Run(doc, "Hello");
// Specify character formatting for the run of text.
Aspose.Words.Font f = run.Font;
f.Name = "Courier New";
f.Size = 36;
f.HighlightColor = Color.Yellow;
// Append the run of text to the end of the first paragraph
// in the body of the first section of the document.
doc.FirstSection.Body.FirstParagraph.AppendChild(run);
lovecomputer:
How to change the font size in a table and table border style of the original document.I have code,But did not change after running.
Please use the following code snippet for your requirement and read following documentation links for your kind reference.
https://docs.aspose.com/words/net/applying-formatting/
https://docs.aspose.com/words/net/working-with-tablestyle/
Document doc = new Document(MyDir + "in.docx");
NodeCollection tables = doc.GetChildNodes(NodeType.Table, true);
foreach (Table table in tables)
{
// Clear any existing borders from the table.
table.ClearBorders();
// Set a green border around the table but not inside.
table.SetBorder(BorderType.Left, LineStyle.Single, 1.5, Color.Green, true);
table.SetBorder(BorderType.Right, LineStyle.Single, 1.5, Color.Green, true);
table.SetBorder(BorderType.Top, LineStyle.Single, 1.5, Color.Green, true);
table.SetBorder(BorderType.Bottom, LineStyle.Single, 1.5, Color.Green, true);
NodeCollection runs = table.GetChildNodes(NodeType.Run, true);
foreach (Run run in runs)
{
//Change the font of table's cell
run.Font.Bold = true;
run.Font.Size = 10;
run.Font.Name = "Times New Roman";
}
}
doc.Save(MyDir + "AsposeOut.docx");
Hope this answers your query. Please let us know if you have any more queries.