Free Support Forum - aspose.com

Re: Table borders visible when using CellFormat.Borders.LineStyle = LineStyle.None

I have attached sample code to further duplicate this bug. This does not work properly in v15.5 or 15.6. The last version of Aspose.Words that worked correctly was 15.4





Document doc = new Document();

DocumentBuilder _builder = new DocumentBuilder(doc);



Aspose.Words.Tables.Cell cell;

Aspose.Words.Tables.Table table = _builder.StartTable();



_builder.ParagraphFormat.Alignment = ParagraphAlignment.Center;

_builder.CellFormat.VerticalAlignment = CellVerticalAlignment.Center;

_builder.Font.Size = 9.0;

_builder.Font.Bold = true;



cell = _builder.InsertCell();

cell.CellFormat.Borders.Top.LineStyle = LineStyle.Thick;

cell.CellFormat.Borders.Bottom.LineStyle = LineStyle.None;



cell.CellFormat.Borders.Left.LineStyle = LineStyle.Thick;

cell.CellFormat.Borders.Right.LineStyle = LineStyle.Thick;

_builder.Write(“a1”);

cell = _builder.InsertCell();

cell.CellFormat.Borders.Left.LineStyle = LineStyle.Single;

_builder.Write(“b1”);

cell = _builder.InsertCell();

cell.CellFormat.Borders.Right.LineStyle = LineStyle.Thick;

_builder.Write(“c1”);

_builder.EndRow();



cell = _builder.InsertCell();

cell.CellFormat.Borders.Top.LineStyle = LineStyle.None;

cell.CellFormat.Borders.Bottom.LineStyle = LineStyle.None;



cell.CellFormat.Borders.Left.LineStyle = LineStyle.Thick;

cell.CellFormat.Borders.Right.LineStyle = LineStyle.Thick;

_builder.Write(“a2”);

cell = _builder.InsertCell();

cell.CellFormat.Borders.Left.LineStyle = LineStyle.Single;

_builder.Write(“b2”);

cell = _builder.InsertCell();

cell.CellFormat.Borders.Right.LineStyle = LineStyle.Thick;

_builder.Write(“c2”);

_builder.EndRow();



cell = _builder.InsertCell();

cell.CellFormat.Borders.Top.LineStyle = LineStyle.None;

cell.CellFormat.Borders.Bottom.LineStyle = LineStyle.Single;



cell.CellFormat.Borders.Left.LineStyle = LineStyle.Thick;

cell.CellFormat.Borders.Right.LineStyle = LineStyle.Thick;

_builder.Write(“a3”);

cell = _builder.InsertCell();

cell.CellFormat.Borders.Left.LineStyle = LineStyle.Single;

_builder.Write(“b3”);

cell = _builder.InsertCell();

cell.CellFormat.Borders.Right.LineStyle = LineStyle.Thick;

_builder.Write(“c3”);

_builder.EndRow();



_builder.EndTable();



doc.Save(“test_table.docx”, Aspose.Words.SaveFormat.Docx);

Tahir, I am having the same issue. I have a table generated in code where the number of columns and rows can vary greatly. A month ago, my code worked perfectly, setting the LineStyle to LineStyle.None for the top and bottom of the border between cells that I wanted to have no border between them. With the latest release it seems that LineStyle.None is functioning as LineStyle.Single.





Here is a snippet of code similar to my project:





_builder.ParagraphFormat.Alignment = ParagraphAlignment.Center;

_builder.CellFormat.VerticalAlignment = CellVerticalAlignment.Center;

_builder.Font.Size = 9.0;

_builder.Font.Bold = true;



Aspose.Words.Tables.Cell cell;



Aspose.Words.Tables.Table table = _builder.StartTable();



for (int r = 0; r
{

for (int i = 0; i < columns.Count; i++)

{

cell = _builder.InsertCell();



switch ®

{

case 0:

cell.CellFormat.Borders.Top.LineStyle = LineStyle.Thick;

cell.CellFormat.Borders.Bottom.LineStyle = LineStyle.None;

break;

case 1:

cell.CellFormat.Borders.Top.LineStyle = LineStyle.None;

cell.CellFormat.Borders.Bottom.LineStyle = LineStyle.None;

break;

case 2:

cell.CellFormat.Borders.Top.LineStyle = LineStyle.None;

cell.CellFormat.Borders.Bottom.LineStyle = LineStyle.Single;

break;

}



//left border

if (i == 0)

{

cell.CellFormat.Borders.Left.LineStyle = LineStyle.Thick;

}

else

{

cell.CellFormat.Borders.Left.LineStyle = LineStyle.Single;

}

//right border

if (i + 1 == columns.Count)

{

cell.CellFormat.Borders.Right.LineStyle = LineStyle.Thick;

}

else

{

cell.CellFormat.Borders.Right.LineStyle = LineStyle.Single;

}

}

}





Obviously lines are missing so that doesn’t compile but you get the general idea. If you have trouble reproducing this error let me know and I’ll try and whip up a short application that shows it (but really you already have a sample from ibmromania)

Hi Michael,

Thanks for your inquiry. I have tested the scenario and have managed to reproduce the same issue at my side. For the sake of correction, I have logged this problem in our issue tracking system as WORDSNET-12114. I have linked this forum thread to the same issue and you will be notified via this forum thread once this issue is resolved.

We apologize for your inconvenience.

Sorry to be a bother, but any luck on a fix for this yet?

Hi Michael,

Thanks
for your inquiry. I would like to share with you that issues are
addressed and resolved based on first come first serve basis. Currently,
this feature is pending for analysis and is in the queue. We will update
you via this forum thread once there is any update available on this feature.

Thank you for your patience and understanding.

Just wanted to see if I could get an idea where this stands in the queue. Thanks!

Hi Michael,

Thanks for your inquiry. I would like to share
with you that this issue has been resolved and its fix will be available
in next version of Aspose.Words v15.7.0. Hopefully, this version of
Aspose.Words will be available at the end of this week. We will inform
you via this forum thread once the new version of Aspose.Words is
published.

Thanks for your patience.

Perfect, thank Tahir! I’ll test it and report back as soon as the next release is published.

The issues you have found earlier (filed as WORDSNET-12114) have been fixed in this .NET update and this Java update.


This message was posted using Notification2Forum from Downloads module by aspose.notifier.
(6)

The issues you have found earlier (filed as WORDSNET-12114) have been fixed in this .NET update and this Java update.


This message was posted using Notification2Forum from Downloads module by aspose.notifier.

Tested and this is working now. Thanks!