Hi
I have the following code to give color to table border,but its not working
Aspose.Words.Document doc = new Aspose.Words.Document(@"C:\Documents and Settings\amj001\Desktop\Report.docx");
Aspose.Words.Tables.Table myTable = doc.FirstSection.Body.Tables[0];
myTable.Rows[0].Cells[0].CellFormat.Borders.Bottom.Color = System.Drawing.Color.Red;
myTable.Rows[0].Cells[0].CellFormat.Borders.Top.Color = System.Drawing.Color.Red;
doc.Save(@"C:\Documents and Settings\amj001\Desktop\AdjustmentsReportOut.docx");
wht i am made wrong here..
Hi Ajeesh,
Thanks for your query. Please use the following code snippet to set the border color. Please use the latest version of Aspose.Words for .NET
Document doc = new Document(MyDir + "in.docx");
Aspose.Words.Tables.Table myTable = doc.FirstSection.Body.Tables[0];
foreach (Row row in myTable.Rows)
{
foreach (Cell cell in row.Cells)
{
cell.CellFormat.Borders.Color = System.Drawing.Color.Red;
}
}
doc.Save(MyDir + "out.docx");
Hi
Thanks for your reply.Here the above example is to change border of all the cells and all borders.my requirement is like to change border color of cells in a particular row also i need to change only one border color like either Top or bottom.
I have another question like,if i have use new version of Aspose.word,will affect the existsing code related to Aspose.word
Hi Ajeesh,
Please use the following code snippet to change the border color of specific row of a table. Please find the input and output document files in attachment. Please read following documentation link for your kind reference.
Working with Tables
Document doc = new Document(MyDir + "in.docx");
Aspose.Words.Tables.Table myTable = doc.FirstSection.Body.Tables[0];
Row row = myTable.Rows[0];
foreach (Cell cell in row.Cells)
{
cell.CellFormat.Borders.Top.Color = System.Drawing.Color.Red;
cell.CellFormat.Borders.Bottom.Color = System.Drawing.Color.Red;
}
row = myTable.Rows[1];
foreach (Cell cell in row.Cells)
{
cell.CellFormat.Borders.Top.Color = System.Drawing.Color.Red;
cell.CellFormat.Borders.Bottom.Color = System.Drawing.Color.Red;
}
doc.Save(MyDir + "out.docx");
Regarding second question, please share from which version you want to upgrade to new version of Aspose.Words for .NET.
Hi
Thanks for your replay.And your not answered to my second question , that is if i have use new version of Aspose.word dll,will affect the existsing code related to Aspose.word
Hi Ajeesh,
My apologies. Please check my last reply.
Regarding second question, please share from which version you want to upgrade to new version of Aspose.Words for .NET.
If you are using very old version of Aspose.Words for .NET, it may need to change your code otherwise no need to change the code. You can test this scenario by upgrading to new version of Aspose.Words for .NET and build your project. Hope this answer your query.
Please let me know, If you have any more queries.
Hi
Am using Aspose.Word 10.1.0.0 dll
Hi Ajeesh,
Thanks for sharing the information. There are a lot of new features and fixes has been done in Aspose.Words for .NET from 10.1.0.0 to latest version (11.3.0). So, it may or may not be need to change your existing code.
We do not know the details of your code. Please upgrade your application with new version of Aspose.Words for .NET and compile your application. This will show you the changes need to be done in your code.
Hope this answers your query. Please let us know, If you have any more queries.