Thanks, it working. Unfortunately there is another problem: this table is huge, should be two pages, but is three because every row exept the first one on every page is in about twice height. The code is complicated since all data comes from a database and becuase of the need for presenting the data different depending on some data-values Therefore I first store the entire pdf-data incl. formatting details in some arrays. The important part of the code looks like this (there is actually another problem: is it possible to have combinations of borderside like left + bottom?):
Dim Pdf1 As New Pdf()
Dim oSection As Aspose.Pdf.Section = Pdf1.Sections.Add()
Dim oCell As Aspose.Pdf.Cell
Dim oCellSeg As Aspose.Pdf.Segment
Dim oCellText As Aspose.Pdf.Text
Dim oRow As Aspose.Pdf.Row
Dim imgX As New Aspose.Pdf.Image()
imgX.ImageInfo.File = Server.MapPath("../images") & "/" & "sluplatta.jpg"
imgX.ImageInfo.ImageFileType = ImageFileType.Jpeg
Dim oTbl As New Aspose.Pdf.Table(oSection)
oTbl.IsFirstRowRepeated = True
Dim marginInfo As MarginInfo = New MarginInfo() 'Instantiate the MarginInfo instance
marginInfo.Top = 20
marginInfo.Bottom = 72
marginInfo.Left = 70
marginInfo.Right = 10
oSection.PageInfo.Margin = marginInfo
oSection.Paragraphs.Add(oTbl)
oSection.BackgroundImageFile = Server.MapPath("../images") & "/" & "SLU10_300.jpg"
oSection.BackgroundImageType = ImageFileType.Jpeg
oTbl.ColumnWidths = "42 42 42 42 42 42 42 42 42 42 42 42"
for r = 0 to antR
oRow = New Aspose.Pdf.Row(oTbl)
oTbl.Rows.Add(oRow)
if r = 25 then oRow.IsInNewPage = True
for c = 0 to 11
if cSpan(r, c) > 0 then
oCell = New Aspose.Pdf.Cell(oTbl)
oCell.ColumnsSpan = cSpan(r, c)
if bordS(r, c) = 1 then ocell.Border = New BorderInfo(CType(BorderSide.top, Integer), 0.5F)
if bordS(r, c) = 2 then ocell.Border = New BorderInfo(CType(BorderSide.all, Integer), 0.5F)
if bordS(r, c) = 3 then ocell.Border = New BorderInfo(CType(BorderSide.left, Integer), 0.5F)
if bordS(r, c) = 4 then ocell.Border = New BorderInfo(CType(BorderSide.right, Integer), 0.5F)
if bordS(r, c) = 5 then ocell.Border = New BorderInfo(CType(BorderSide.bottom, Integer), 0.5F)
if bordS(r, c) = 11 then ocell.Border = New BorderInfo(CType(BorderSide.top, Integer), 1.5F)
if bordS(r, c) = 12 then ocell.Border = New BorderInfo(CType(BorderSide.all, Integer), 1.5F)
if bordS(r, c) = 13 then ocell.Border = New BorderInfo(CType(BorderSide.left, Integer), 1.5F)
if bordS(r, c) = 14 then ocell.Border = New BorderInfo(CType(BorderSide.right, Integer), 1.5F)
if bordS(r, c) = 15 then ocell.Border = New BorderInfo(CType(BorderSide.bottom, Integer), 1.5F)
if c = 1 then oCell.ColumnsSpan = 2
oRow.Cells.Add(oCell)
if r = 0 and c = 0 then
oCell.Paragraphs.Add(imgX)
else
oCellText = New Aspose.Pdf.Text(oSection)
oCell.Paragraphs.Add(oCellText)
oCellSeg = New Aspose.Pdf.Segment(oCellText)
oCellText.Segments.Add(oCellSeg)
if align(r, c) = 1 then oCellText.TextInfo.Alignment = AlignmentType.Left
if align(r, c) = 2 then oCellText.TextInfo.Alignment = AlignmentType.Center
if align(r, c) = 3 then oCellText.TextInfo.Alignment = AlignmentType.Right
With oCellSeg.TextInfo
.FontName = fontT(r, c) '"Courier" '"Times-Roman"
.FontSize = fontS(r, c)
if boldI(r, c) = "b" then .IsTrueTypeFontBold = true
if boldI(r, c) = "i" then .IsTrueTypeFontItalic = true
End With
oCellSeg.Content = value(r, c)
oCell.Paragraphs.Add(oCellText)
oCellSeg = New Aspose.Pdf.Segment(oCellText)
oCellText.Segments.Add(oCellSeg)
end if
end if 'cSpan > 0
next
next
Pdf1.Save("testTable.pdf", SaveType.OpenInAcrobat, Response)