PDFsharp & MigraDoc Foundation

PDFsharp - A .NET library for processing PDF & MigraDoc Foundation - Creating documents on the fly
It is currently Sat Apr 27, 2024 10:01 am

All times are UTC


Forum rules


Please read this before posting on this forum: Forum Rules



Post new topic Reply to topic  [ 4 posts ] 
Author Message
PostPosted: Mon Mar 01, 2010 10:36 pm 
Offline

Joined: Mon Mar 01, 2010 10:29 pm
Posts: 2
Hi, everyone -

I'm having a problem with borders on table cells. I'm having borders appear even if I turn them off on a specific cell. This is the code that creates the specific table. In the example below, the cells with the words "HELPERS" and "DATE" should not have a bottom border on them, but no matter what I do, they still show the border. I've tried setting the borders Visible = False, I've tried setting the width = 0, I've tried setting the border color = white. No luck at all.

Any help would be appreciated!

Code:
 

        namesTable = section.AddTable()
        namesTable.Style = "Table"
        namesTable.Format.Font.Name = "Arial"
        namesTable.LeftPadding = 0
        namesTable.RightPadding = 0

        ''col0
        column = namesTable.AddColumn("1.5in")
        column.Format.Alignment = ParagraphAlignment.Left

        ''col1
        column = namesTable.AddColumn("0.5in")
        column.Format.Alignment = ParagraphAlignment.Center

        ''col2
        column = namesTable.AddColumn("1.5in")
        column.Format.Alignment = ParagraphAlignment.Center

        ''col3
        column = namesTable.AddColumn("0.5in")
        column.Format.Alignment = ParagraphAlignment.Center

        ''col4
        column = namesTable.AddColumn("1.5in")
        column.Format.Alignment = ParagraphAlignment.Center

        ''col5
        column = namesTable.AddColumn("0.5in")
        column.Format.Alignment = ParagraphAlignment.Center

        ''col6
        column = namesTable.AddColumn("1.0in")
        column.Format.Alignment = ParagraphAlignment.Center

        row = namesTable.AddRow()
        row.Height = "0.17in"

        With row.Cells(0)
            .AddParagraph("BORING CONTRACTOR")
            .VerticalAlignment = VerticalAlignment.Bottom
            .Format.Alignment = ParagraphAlignment.Left
            .MergeRight = 1
        End With

        With row.Cells(2)
            .AddParagraph(myBoring.Contractor_ID)
            .VerticalAlignment = VerticalAlignment.Bottom
            .Format.Alignment = ParagraphAlignment.Center
            .Borders.Bottom.Width = 0.25
            .MergeRight = 4
        End With

        row = namesTable.AddRow()
        row.Height = "0.17in"

        With row.Cells(0)
            .AddParagraph("DRILLER")
            .VerticalAlignment = VerticalAlignment.Bottom
            .Format.Alignment = ParagraphAlignment.Left
        End With

        With row.Cells(1)
            .AddParagraph(myBoring.Driller_Name)
            .VerticalAlignment = VerticalAlignment.Bottom
            .Format.Alignment = ParagraphAlignment.Center
            .MergeRight = 1
            .Borders.Bottom.Width = 0.25
        End With

        With row.Cells(3)
            .AddParagraph("HELPERS")
            .VerticalAlignment = VerticalAlignment.Bottom
            .Format.Alignment = ParagraphAlignment.Left
            .Borders.Bottom.Visible = False
            .Borders.Visible = False
        End With

        With row.Cells(4)
            .AddParagraph(myBoring.Helper_Name)
            .VerticalAlignment = VerticalAlignment.Bottom
            .Format.Alignment = ParagraphAlignment.Center
            .Borders.Bottom.Width = 0.25
            .MergeRight = 2
        End With

        row = namesTable.AddRow()
        row.Height = "0.17in"

        With row.Cells(0)
            .AddParagraph("RESIDENT ENGINEER")
            .VerticalAlignment = VerticalAlignment.Bottom
            .Format.Alignment = ParagraphAlignment.Left
            .MergeRight = 1
        End With

        With row.Cells(2)
            .AddParagraph(myBoring.Resident_Engineer_Full_Name)
            .VerticalAlignment = VerticalAlignment.Bottom
            .Format.Alignment = ParagraphAlignment.Center
            .Borders.Bottom.Width = 0.25
            .Borders.Top.Visible = False
            .MergeRight = 2
        End With

        With row.Cells(5)
            .AddParagraph("DATE")
            .VerticalAlignment = VerticalAlignment.Bottom
            .Format.Alignment = ParagraphAlignment.Left
            .Borders.Bottom.Visible = False
        End With

        With row.Cells(6)
            .AddParagraph("")
            .VerticalAlignment = VerticalAlignment.Bottom
            .Format.Alignment = ParagraphAlignment.Left
            .Borders.Bottom.Width = 0.25
        End With

        row = namesTable.AddRow()
        row.Height = "0.17in"

        With row.Cells(0)
            .AddParagraph("CLASSIFICATION CHECK")
            .VerticalAlignment = VerticalAlignment.Bottom
            .Format.Alignment = ParagraphAlignment.Left
            .MergeRight = 1
        End With

        With row.Cells(2)
             .AddParagraph(myBoring.Classification_Checker_Full_Name)
            .VerticalAlignment = VerticalAlignment.Bottom
            .Format.Alignment = ParagraphAlignment.Center
            .Borders.Bottom.Width = 0.25
            .MergeRight = 4
        End With


Top
 Profile  
Reply with quote  
PostPosted: Tue Mar 02, 2010 8:56 am 
Offline
PDFsharp Guru
User avatar

Joined: Mon Oct 16, 2006 8:16 am
Posts: 3096
Location: Cologne, Germany
Hiding the bottom border of a cell will not prevent the top border of the cell below from being drawn.

_________________
Regards
Thomas Hoevel
PDFsharp Team


Top
 Profile  
Reply with quote  
PostPosted: Wed Mar 03, 2010 8:52 pm 
Offline

Joined: Mon Mar 01, 2010 10:29 pm
Posts: 2
Thomas,

Thanks. There aren't any top borders on the cells below - it's bottom borders only. To confirm this, I've updated the code to turn off any top borders off in all the cells. I'm still having the same problem. The best I can tell, it occurs when the cell below is merged to the right and it goes under the cell that I can't turn the bottom border off on.

Is there any way to fix this? Or would I need to draw a separate table for each row?

My updated code is below.

Thanks,

Aaron

Code:
 namesTable = section.AddTable()
        namesTable.Style = "Table"
        namesTable.Format.Font.Name = "Arial"
        namesTable.LeftPadding = 0
        namesTable.RightPadding = 0

        ''col0
        column = namesTable.AddColumn("1.5in")
        column.Format.Alignment = ParagraphAlignment.Left

        ''col1
        column = namesTable.AddColumn("0.5in")
        column.Format.Alignment = ParagraphAlignment.Center

        ''col2
        column = namesTable.AddColumn("1.5in")
        column.Format.Alignment = ParagraphAlignment.Center

        ''col3
        column = namesTable.AddColumn("0.5in")
        column.Format.Alignment = ParagraphAlignment.Center

        ''col4
        column = namesTable.AddColumn("1.5in")
        column.Format.Alignment = ParagraphAlignment.Center

        ''col5
        column = namesTable.AddColumn("0.5in")
        column.Format.Alignment = ParagraphAlignment.Center

        ''col6
        column = namesTable.AddColumn("1.0in")
        column.Format.Alignment = ParagraphAlignment.Center

        row = namesTable.AddRow()
        row.Height = "0.17in"

        With row.Cells(0)
            .AddParagraph("BORING CONTRACTOR")
            .VerticalAlignment = VerticalAlignment.Bottom
            .Format.Alignment = ParagraphAlignment.Left
            .MergeRight = 1
            .Borders.Top.Visible = False
        End With

        With row.Cells(2)
            .AddParagraph(myBoring.Contractor_ID)
            .VerticalAlignment = VerticalAlignment.Bottom
            .Format.Alignment = ParagraphAlignment.Center
            .Borders.Bottom.Width = 0.25
            .MergeRight = 4
            .Borders.Top.Visible = False
        End With

        row = namesTable.AddRow()
        row.Height = "0.17in"

        With row.Cells(0)
            .AddParagraph("DRILLER")
            .VerticalAlignment = VerticalAlignment.Bottom
            .Format.Alignment = ParagraphAlignment.Left
            .Borders.Top.Visible = False
        End With

        With row.Cells(1)
            .AddParagraph(myBoring.Driller_Name)
            .VerticalAlignment = VerticalAlignment.Bottom
            .Format.Alignment = ParagraphAlignment.Center
            .MergeRight = 1
            .Borders.Bottom.Width = 0.25
            .Borders.Top.Visible = False
        End With

        With row.Cells(3)
            .AddParagraph("HELPERS")
            .VerticalAlignment = VerticalAlignment.Bottom
            .Format.Alignment = ParagraphAlignment.Left
            .Borders.Bottom.Visible = False
            .Borders.Visible = False
            .Borders.Top.Visible = False
        End With

        With row.Cells(4)
            .AddParagraph(myBoring.Helper_Name)
            .VerticalAlignment = VerticalAlignment.Bottom
            .Format.Alignment = ParagraphAlignment.Center
            .Borders.Bottom.Width = 0.25
            .MergeRight = 2
            .Borders.Top.Visible = False
        End With

        row = namesTable.AddRow()
        row.Height = "0.17in"

        With row.Cells(0)
            .AddParagraph("RESIDENT ENGINEER")
            .VerticalAlignment = VerticalAlignment.Bottom
            .Format.Alignment = ParagraphAlignment.Left
            .MergeRight = 1
            .Borders.Top.Visible = False
        End With

        With row.Cells(2)
            .AddParagraph(myBoring.Resident_Engineer_Full_Name)
            .VerticalAlignment = VerticalAlignment.Bottom
            .Format.Alignment = ParagraphAlignment.Center
            .Borders.Bottom.Width = 0.25
            .Borders.Top.Visible = False
            .MergeRight = 2
        End With

        With row.Cells(5)
            .AddParagraph("DATE")
            .VerticalAlignment = VerticalAlignment.Bottom
            .Format.Alignment = ParagraphAlignment.Left
            .Borders.Top.Visible = False
            .Borders.Visible = False
            .Borders.Bottom.Visible = False
        End With

        With row.Cells(6)
            'quickly will check for max date
            Try
                Dim myDC As New mrce_boring_dbOfficeDataClassesDataContext
                Dim endDate As Date
                Dim myDailyProgressEndDate = (From b In myDC.Boring_Daily_Progresses Where b.BDP_Boring_ID = myBoring.Boring_GUID _
                                      Select b.BDP_End_Date_Time).Max

                If Not myDailyProgressEndDate Is Nothing Then
                    endDate = CDate(myDailyProgressEndDate)
                    .AddParagraph(Format(endDate.Date, "MM-dd-yy"))
                Else
                    .AddParagraph("")
                End If
            Catch
                .AddParagraph("")
            End Try
            .VerticalAlignment = VerticalAlignment.Bottom
            .Format.Alignment = ParagraphAlignment.Left
            .Borders.Bottom.Width = 0.25
            .Borders.Top.Visible = False
        End With

        row = namesTable.AddRow()
        row.Height = "0.17in"

        With row.Cells(0)
            .AddParagraph("CLASSIFICATION CHECK")
            .VerticalAlignment = VerticalAlignment.Bottom
            .Format.Alignment = ParagraphAlignment.Left
            .MergeRight = 1
            .Borders.Top.Visible = False
        End With

        With row.Cells(2)
            If myBoring.All_Approved = True Then
                .AddParagraph(myBoring.Classification_Checker_Full_Name)
            Else
                .AddParagraph("OFFICE DRAFT")
            End If
            .VerticalAlignment = VerticalAlignment.Bottom
            .Format.Alignment = ParagraphAlignment.Center
            .Borders.Bottom.Width = 0.25
            .MergeRight = 4
            .Borders.Top.Visible = False
        End With

    End Sub


Top
 Profile  
Reply with quote  
PostPosted: Thu Mar 04, 2010 8:34 am 
Offline
PDFsharp Guru
User avatar

Joined: Mon Oct 16, 2006 8:16 am
Posts: 3096
Location: Cologne, Germany
aglazer wrote:
My updated code is below.

Too much code - and still a snippet only.

If you give me a MDDDL file of that table I'll take a look at it.
http://www.pdfsharp.net/wiki/MigraDocDDL.ashx

_________________
Regards
Thomas Hoevel
PDFsharp Team


Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 4 posts ] 

All times are UTC


Who is online

Users browsing this forum: Google [Bot] and 413 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Privacy Policy, Data Protection Declaration, Impressum
Powered by phpBB® Forum Software © phpBB Group