Row Border formats are not applied

Hello,
at the moment, I’m changing the printing in our applications from Crystal Reports to Aspose.Words.
Unfortunately I have some problems formatting the automated generated tables to make them look like in our previous CR printouts.
What I want is, that some rows have a thicker bottom line than the other ones. So far I tried to set the
oBuilder.RowFormat.Borders.Bottom.LineWidth
property before and after drawing the cells, and setting the CellFormat.Borders.Bottom.LineWidth Property after drawing each cell, but all I get are thicker bottom lines at page-breaks and at the end of tables, but not where I really want them.
Am I doing something wrong, or is the drawing of thicker borders at certain positions not possible at the moment?
Regards,
Oliver

Hi

Thanks for your inquiry. Could you please provide me sample code, which will allow me to reproduce the problem? I will check it on my side and provide you more information.
Also, it would be useful if you attach your output and expected documents.
Best regards,

Hello,
following the code block which creates the rows which don’t appear like expected:

If Not oDataAnsprechpartner Is Nothing Then
    For Each oRow As DataRow In oDataAnsprechpartner.Rows
        oBuilder.InsertCell()
        oBuilder.Writeln(oRow("Titel").ToString)
        oBuilder.InsertCell()
        oBuilder.Writeln(oRow("Position").ToString)
        oBuilder.InsertCell()
        oBuilder.Writeln(oRow("Telefon"))
        oBuilder.InsertCell()
        oBuilder.Writeln(oRow("Mobilfunk").ToString)
        oBuilder.EndRow()
        oBuilder.InsertCell()
        oBuilder.Writeln(oRow("Ansprechpartner"))
        oBuilder.InsertCell()
        oBuilder.Writeln(oRow("Abteilung").ToString)
        oBuilder.InsertCell()
        oBuilder.Writeln(oRow("Telefax").ToString)
        oBuilder.InsertCell()
        oBuilder.Writeln(oRow("EMail").ToString)
        oBuilder.RowFormat.Borders.Bottom.LineWidth = 2
        oBuilder.EndRow()
    Next
End If

In the attachments there first is the expected result (sample.doc) and the actual result (Stammblatt.pdf) (which is that only the lines at table breaks / ends are thick).
Thank you in advance!
Regards,
Oliver Braun

Hi

Thank you for additional information. Please try using the following code

// Set default formating for all borders of the table
builder.CellFormat.Borders.LineStyle = LineStyle.Single;
builder.CellFormat.Borders.Color = Color.Gray;
for (int i = 0; i <10; i++)
{
    // Reset formating to default
    builder.CellFormat.Borders.Bottom.LineStyle = LineStyle.Single;
    builder.CellFormat.Borders.Bottom.LineWidth = 1;
    builder.CellFormat.Borders.Bottom.Color = Color.Gray;
    // Insert first row.
    builder.InsertCell();
    builder.Writeln("Titel");
    builder.InsertCell();
    builder.Writeln("Position");
    builder.InsertCell();
    builder.Writeln("Telefon");
    builder.InsertCell();
    builder.Writeln("Mobilfunk");
    builder.EndRow();
    // Set formating for the second row
    builder.CellFormat.Borders.Bottom.LineStyle = LineStyle.Single;
    builder.CellFormat.Borders.Bottom.LineWidth = 2;
    builder.CellFormat.Borders.Bottom.Color = Color.Black;
    // Insert second row
    builder.InsertCell();
    builder.Writeln("Ansprechpartner");
    builder.InsertCell();
    builder.Writeln("Abteilung");
    builder.InsertCell();
    builder.Writeln("Telefax");
    builder.InsertCell();
    builder.Writeln("EMail");
    builder.EndRow();
}
builder.EndTable();

Hope this helps.
Best regards,

Hello and thanks for your help.
Unfortunately, this solution didn’t work for me.
Following is the new code (this time including the full code for the table) and in the attachments is the new result.

oBuilder.MoveToBookmark("bTable")
oBuilder.StartTable()
oBuilder.CellFormat.Borders.LineStyle = LineStyle.Single
oBuilder.CellFormat.Borders.Color = Color.Gray
oBuilder.RowFormat.HeightRule = HeightRule.Exactly
oBuilder.RowFormat.Height = oBuilder.Font.Size + 1
oBuilder.InsertCell()
oBuilder.Writeln("Titel")
oBuilder.CellFormat.Width = 115
oBuilder.InsertCell()
oBuilder.Writeln("Position")
oBuilder.CellFormat.Width = 115
oBuilder.InsertCell()
oBuilder.Writeln("Telefon")
oBuilder.CellFormat.Width = 115
oBuilder.InsertCell()
oBuilder.Writeln("Mobil")
oBuilder.CellFormat.Width = 115
oBuilder.EndRow()
oBuilder.InsertCell()
oBuilder.Writeln("Ansprechpartner")
oBuilder.CellFormat.Width = 115
oBuilder.InsertCell()
oBuilder.Writeln("Abteilung")
oBuilder.CellFormat.Width = 115
oBuilder.InsertCell()
oBuilder.Writeln("Telefax")
oBuilder.CellFormat.Width = 115
oBuilder.InsertCell()
oBuilder.Writeln("E-Mail")
oBuilder.CellFormat.Width = 115
oBuilder.EndRow()
Dim oDataAnsprechpartner As New DataTable sQry = "SELECT * FROM KHKAnsprechpartner WHERE Mandant = " & gsSQLString(oKontakt.iMandant) & " AND Adresse = " & gsSQLString(oKontakt.lAdresse)
oDataAnsprechpartner = goData.oOLData.oGetQueryData(sQry)
oBuilder.CellFormat.Borders.LineStyle = LineStyle.Single
oBuilder.CellFormat.Borders.Color = Color.Gray

If Not oDataAnsprechpartner Is Nothing Then
    For Each oRow As DataRow In oDataAnsprechpartner.Rows
        oBuilder.CellFormat.Borders.Bottom.LineStyle = LineStyle.Single
        oBuilder.CellFormat.Borders.Bottom.LineWidth = 1
        oBuilder.CellFormat.Borders.Bottom.Color = Color.Gray
        oBuilder.InsertCell()
        oBuilder.Writeln(oRow("Titel").ToString)
        oBuilder.InsertCell()
        oBuilder.Writeln(oRow("Position").ToString)
        oBuilder.InsertCell()
        oBuilder.Writeln(oRow("Telefon"))
        oBuilder.InsertCell()
        oBuilder.Writeln(oRow("Mobilfunk").ToString)
        oBuilder.EndRow()
        oBuilder.CellFormat.Borders.Bottom.LineStyle = LineStyle.Single
        oBuilder.CellFormat.Borders.Bottom.LineWidth = 2
        oBuilder.CellFormat.Borders.Bottom.Color = Color.Black
        oBuilder.InsertCell()
        oBuilder.Writeln(oRow("Ansprechpartner"))
        oBuilder.InsertCell()
        oBuilder.Writeln(oRow("Abteilung").ToString)
        oBuilder.InsertCell()
        oBuilder.Writeln(oRow("Telefax").ToString)
        oBuilder.InsertCell()
        oBuilder.Writeln(oRow("EMail").ToString)
        oBuilder.EndRow()

    Next
    oBuilder.EndTable()
End If

Regards,
Oliver Braun

Hi

Thanks for your request. I managed to reproduce the problem with bottom borders. Your request has been linked to the appropriate issue. We will let you know once this issue is resolved.
As workaround you can try using top borders, see the following code:

Dim doc As Document = New Document()
Dim oBuilder As DocumentBuilder = New DocumentBuilder(doc)
oBuilder.StartTable()
oBuilder.CellFormat.Borders.LineStyle = LineStyle.Single
oBuilder.CellFormat.Borders.Color = Color.Gray
oBuilder.InsertCell()
oBuilder.Write("Titel")
oBuilder.CellFormat.Width = 115
oBuilder.InsertCell()
oBuilder.Write("Position")
oBuilder.CellFormat.Width = 115
oBuilder.InsertCell()
oBuilder.Write("Telefon")
oBuilder.CellFormat.Width = 115
oBuilder.InsertCell()
oBuilder.Write("Mobil")
oBuilder.CellFormat.Width = 115
oBuilder.EndRow()
oBuilder.InsertCell()
oBuilder.Write("Ansprechpartner")
oBuilder.CellFormat.Width = 115
oBuilder.InsertCell()
oBuilder.Write("Abteilung")
oBuilder.CellFormat.Width = 115
oBuilder.InsertCell()
oBuilder.Write("Telefax")
oBuilder.CellFormat.Width = 115
oBuilder.InsertCell()
oBuilder.Write("E-Mail")
oBuilder.CellFormat.Width = 115
oBuilder.EndRow()

' Create dummy data source
Dim oDataAnsprechpartner As New DataTable
oDataAnsprechpartner.Columns.Add("Titel")
oDataAnsprechpartner.Columns.Add("Position")
oDataAnsprechpartner.Columns.Add("Telefon")
oDataAnsprechpartner.Columns.Add("Mobilfunk")
oDataAnsprechpartner.Columns.Add("Ansprechpartner")
oDataAnsprechpartner.Columns.Add("Abteilung")
oDataAnsprechpartner.Columns.Add("Telefax")
oDataAnsprechpartner.Columns.Add("EMail")

For i As Integer = 0 To 15
    oDataAnsprechpartner.Rows.Add(New Object() {"Titel", "Position", "Telefon", "Mobilfunk", "Ansprechpartner", "Abteilung", "Telefax", "EMail"})
Next
If Not oDataAnsprechpartner Is Nothing Then
    For Each oRow As DataRow In oDataAnsprechpartner.Rows
        oBuilder.CellFormat.Borders.Top.LineStyle = LineStyle.Single
        oBuilder.CellFormat.Borders.Top.LineWidth = 2
        oBuilder.CellFormat.Borders.Top.Color = Color.Black

        ' Insert first row
        oBuilder.InsertCell()
        oBuilder.Write(oRow("Titel").ToString)
        oBuilder.InsertCell()
        oBuilder.Write(oRow("Position").ToString)
        oBuilder.InsertCell()
        oBuilder.Write(oRow("Telefon"))
        oBuilder.InsertCell()
        oBuilder.Write(oRow("Mobilfunk").ToString)
        oBuilder.EndRow()

        ' Reset defaults
        oBuilder.CellFormat.Borders.Top.LineStyle = LineStyle.Single
        oBuilder.CellFormat.Borders.Top.LineWidth = 0
        oBuilder.CellFormat.Borders.Top.Color = Color.Gray

        ' Insert the second row
        oBuilder.InsertCell()
        oBuilder.Write(oRow("Ansprechpartner"))
        oBuilder.InsertCell()
        oBuilder.Write(oRow("Abteilung").ToString)
        oBuilder.InsertCell()
        oBuilder.Write(oRow("Telefax").ToString)
        oBuilder.InsertCell()
        oBuilder.Write(oRow("EMail").ToString)
        oBuilder.EndRow()

    Next
    oBuilder.EndTable()
End If
doc.Save("Test001\out.doc")
doc.Save("Test001\out.pdf")

Hope this helps.
Best regards,

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

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