Free Support Forum - aspose.com

Alignment problems--very frustrating

In a table I am simply trying to make sure the second column which contains dollar amounts, that they are all aligned right so the numbers line up with each other, when I do this the whole column dissapeears, please help

here is the code
for loop
Dim rowval As Row = currtable.Rows.Add()

Dim c As Cell = rowval.Cells.Add(dtrows.Item(0))

c.Padding.Left = 320

Dim tcell As New TextInfo

Dim myc As Cell = rowval.Cells.Add(Format(dtrows.Item(1), “C”))

tcell.Alignment = AlignmentType.Right<------ **this makes the column just dissappear

myc.DefaultCellTextInfo = tcell

loop

by the way here is the top of the code that creates the table

Dim currtable As New Aspose.Pdf.Table

With sec1.PageInfo

.Margin.Left = 0

.Margin.Right = 0

.Margin.Top = 50

.Margin.Bottom = 0

End With

sec1.Paragraphs.Add(currtable)

currtable.Alignment = AlignmentType.Center

currtable.DefaultCellTextInfo = tabletext

currtable.ColumnWidths = “590 530”

Dim headrow As Row = currtable.Rows.Add()

Dim headcell As Cell = headrow.Cells.Add(“Current Fund Investments”)

headcell.ColumnsSpan = 2

headcell.DefaultCellTextInfo = line

headcell.Padding.Left = 450

Dim total As Decimal

total = dt.Rows(0).Item(“end_mv”)

dt.Clear()

conn.Open()

sql = “Select inv_name,mkt_val from curfndal where account=’” + Session(“acct”) + “’”

Dim mycomm As New SqlCommand(sql, conn)

Dim myda As New SqlDataAdapter(mycomm)

Dim newdt As New DataTable

myda.Fill(newdt)

Dim dtrows As DataRow

Dear bsarram,

Thank you for considering Aspose.

I can’t reproduce this error from the code above. Can you please send me a complete example via email? I will solve this problem soon.

I sent code early last week, any luck?

Dear bsarram,

Thank you for considering Aspose.

I have received it. I am now woking on this issue and I will soon solve the problem.

Dear bsarram,

Thank you for considering Aspose.

I have tested you example and found that you table is too large and exceed the page width. If you set the page width to 1500 points, you can see the second column. So please reduce the table’s column width.

Tommy that does not make any sense since the code I sent you under the last table I set the widths too
currtable.ColumnWidths = "590 530" since I need two columsn how can I just set the width to 1500 Points? can you show code?
thanks

Dear bsarram,

Thank you for considering Aspose.

I have used the following line to set the page width to 1500 points:
sec1.PageInfo.PageWidth = 1500

You can just set the ColumnWidth to small number such as “190 130”.