Knowledgebase (330)
The sample demonstrates how to Create Excel file for Silverlight via Spire.XLS.

The sample demonstrates how to add bookmark into Word for Silverlight via Spire.Doc.

Step 1 Load Document
Create a C#/VB.NET project in Visual Studio. Add Spire.Doc.dll as reference.
Document document = new Document();
document.LoadFromFile(@"E:\work\Documents\Student Transcript.docx");
Dim document As New Document()
document.LoadFromFile("E:\work\Documents\Student Transcript.docx")
Step 2 Set Table Style
Because table1 type is different from document.Sections[0].Tables[1] type, so use (Table) to transformed forcibly.
Table table1 = (Table)document.Sections[0].Tables[1];
Dim table1 As Table = CType(document.Sections(0).Tables(1), Table)
table1.Rows[0].Height = 25;
table1.Rows(0).Height = 25
In order to have distinction. Keep the first cell in first row as before and set style for the second cell. Firstly, set alignment and background color for the second cell. Secondly, declare a paragraph style, including font size, color and apply this style in cell.
table1.Rows[0].Cells[1].CellFormat.VerticalAlignment = VerticalAlignment.Middle;
table1.Rows[0].Cells[1].CellFormat.BackColor = Color.LimeGreen;
ParagraphStyle style = new ParagraphStyle(document);
style.Name = "TableStyle";
style.CharacterFormat.FontSize = 14;
style.CharacterFormat.TextColor = Color.GhostWhite;
document.Styles.Add(style);
table1.Rows[0].Cells[1].Paragraphs[0].ApplyStyle(style.Name);
table1.Rows(0).Cells(1).CellFormat.VerticalAlignment = VerticalAlignment.Middle
table1.Rows(0).Cells(1).CellFormat.BackColor = Color.LimeGreen
Dim style As New ParagraphStyle(document)
style.Name = "TableStyle"
style.CharacterFormat.FontSize = 14
style.CharacterFormat.TextColor = Color.GhostWhite
document.Styles.Add(style)
table1.Rows(0).Cells(1).Paragraphs(0).ApplyStyle(style.Name)
Step 3 Save and Launch
document.SaveToFile("WordTable.docx", FileFormat.Docx);
System.Diagnostics.Process.Start("WordTable.docx");
document.SaveToFile("WordTable.docx", FileFormat.Docx)
System.Diagnostics.Process.Start("WordTable.docx")
Effective Screenshot

This guide shows how to set Word table style such as size and color via Spire.Doc. However, Spire.Doc can do a lot on operating Word document Click to learn more…

