Free Support Forum -

When Data on cell is larger than column size

I found that when cell text size is larger than the columnwidth, error will occurr.
Please help to fix this, thanks.


table1 = New Aspose.Pdf.Table

table1.ColumnWidths = BorderLength '"180 180 180"

For j = 0 To MyTable.Rows.Count - 1
row1 = table1.Rows.Add()
row1.Cells.Add(" ")
row1 = table1.Rows.Add()
For i = 0 To MyTable.Columns.Count - 1
cell1 = row1.Cells.Add(MyTable.Rows(j)(i))
tempText = cell1.Paragraphs(0)
tempText.Segments(0).TextInfo.FontName = "Helvetica"
'----- Trun UniCode On to Show Chinese
tempText.Segments(0).TextInfo.IsUnicode = True
tempText.Segments(0).TextInfo.TruetypeFontFileName = "c:/winnt/fonts/SIMHEI.ttf"
tempText.Segments(0).TextInfo.FontSize = 9


Microsoft.VisualBasic.CompilerServices.VBBinder.set_InternalThrow(Exception Value) +16
Microsoft.VisualBasic.CompilerServices.VBBinder.BindToMethod(BindingFlags bindingAttr, MethodBase[] match, Object[]& args, ParameterModifier[] modifiers, CultureInfo culture, String[] names, Object& ObjState) +4896
Microsoft.VisualBasic.CompilerServices.VBBinder.InvokeMember(String name, BindingFlags invokeAttr, Type objType, IReflect objIReflect, Object target, Object[] args, ParameterModifier[] modifiers, CultureInfo culture, String[] namedParameters) +596
Microsoft.VisualBasic.CompilerServices.LateBinding.LateGet(Object o, Type objType, String name, Object[] args, String[] paramnames, Boolean[] CopyBack) +480
suncypress.WebForm3.CreatePDF() in D:\WebFolder\SunTest\suncypress\rptpreview\rpt_PDF.aspx.vb:151
suncypress.WebForm3.Page_Load(Object sender, EventArgs e) in D:\WebFolder\SunTest\suncypress\rptpreview\rpt_PDF.aspx.vb:56
System.Web.UI.Control.OnLoad(EventArgs e) +67
System.Web.UI.Control.LoadRecursive() +35
System.Web.UI.Page.ProcessRequestMain() +731

Hi EddyWan,

Thank you for considering Aspose.

I have tested but can’t reproduce this error. Can you please give me an runable example without datatable?

Hi forever,

Here is the vb file of my code:

And the Global function call in code:

Public Shared Function GetSQLResultAsDataTable(ByVal strSQL As String) As DataTable Dim conn As SqlConnection Dim da As SqlDataAdapter Dim dt As New DataTable

conn = New SqlConnection(ConfigurationSettings.AppSettings("ConnectionString")) da = New SqlDataAdapter(strSQL, conn) da.Fill(dt)

Return dt End Function


Finally I got what the problem is.
I just change Time Field to String and work fine. ^^
Many thanks for your help.