Hi Team ,
Is it possible to add our own contents in Authors section[in file's properties] .Please check the attached file for your reference.
Thanks in advance
// Create a new document object
Document doc = new Document();
// Add a section to the document
Spire.Doc.Section section = doc.AddSection();
// Get the built-in document properties
BuiltinDocumentProperties builtinProperties = doc.BuiltinDocumentProperties;
// Set the author property of the built-in document properties
builtinProperties.Author = "Spire.Doc";
// Save the document to a file
doc.SaveToFile(@"Set_Properties.docx"); // Create a new document object
Document doc = new Document();
// Add a section to the document
Section section = doc.AddSection();
// Add a table to the section with merged cells
Table table = section.AddTable(true);
// Reset the cells of the table starting from row 1 and column 2
table.ResetCells(1, 2);
// Add a paragraph with text "product" to the first cell in the first row and set its format
TextRange range = table[0, 0].AddParagraph().AppendText("product");
range.CharacterFormat.FontName = "Arial";
range.CharacterFormat.FontSize = 10;
range.CharacterFormat.TextColor = Color.Teal;
range.CharacterFormat.Bold = true;
// Add a paragraph with text "price" to the second cell in the first row and set its format
range = table[0, 1].AddParagraph().AppendText("price");
range.CharacterFormat.FontName = "Calibri";
range.CharacterFormat.FontSize = 5;
range.CharacterFormat.TextColor = Color.Teal;
range.CharacterFormat.Bold = true;
// Save the document to a file named "Table.docx" in Docx format
doc.SaveToFile("Table.docx", FileFormat.Docx);
// Create a new document object
Document document = new Document();
// Load the content of the "data/table.docx" file into the document
document.loadFromFile("data/table.docx");
// Get the first section of the document
Section section = document.getSections().get(0);
// Get the first table in the section
Table table = section.getTables().get(0);
// Create a new paragraph style object
ParagraphStyle style = new ParagraphStyle(document);
// Set the name of the style to "TableStyle"
style.setName("TableStyle");
// Set the font name and size for the style
style.getCharacterFormat().setFontName("Calibri");
style.getCharacterFormat().setFontSize(25);
// Add the style to the document's styles
document.getStyles().add(style);
// Iterate through each row in the table
for (int i = 0; i < table.getRows().getCount(); i++) {
// Get the current row
TableRow row = table.getRows().get(i);
// Iterate through each cell in the row
for (int j = 0; j < row.getCells().getCount(); j++) {
// Get the current cell
TableCell cell = row.getCells().get(j);
// Check if the text in the first paragraph of the cell is empty
if (cell.getParagraphs().get(0).getText() == "") {
// Apply the "TableStyle" to the cell by setting its paragraph's style to "TableStyle"
table.get(i, j).getParagraphs().get(0).applyStyle("TableStyle");
}
}
}
// Save the modified document to a new file named "output/result.docx" with the Docx_2013 format
document.saveToFile("output/result.docx", FileFormat.Docx_2013);
listStyle.getLevels().get(0).setFollowCharacter(FollowCharacterType.Nothing);// Get the list style's level list and set the first level's suffix to an empty string
listStyle.getLevels().get(0).setNumberSufix(""); listStyle.getLevels().get(0).setFollowCharacter(FollowCharacterType.Space);