Free Support Forum - aspose.com

"The table is too large"?

I’m doing an XSL on XML I get from serializing some business objects which is transformed into Aspose.Pdf XML at runtime. The first run through went fine, so I decided to start adding some more polished formatting. What I’m feeding into the BindXML method is still pretty basic, but when it tries to execute I get …

“An unhandled exception of type ‘System.ApplicationException’ occurred in aspose.pdf.dll”

"Additional information: The table is too large."

The C# code that’s executing is the following …

private void Form1_Load(object sender, System.EventArgs e)
{
Pdf pdfDoc = new Pdf();

pdfDoc.FontConfigFile = @“C:\Inetpub\wwwroot\Vega\xml\font-config.xml”;
pdfDoc.BindXML(@“C:\Data\Serialization.xml”, @“C:\Inetpub\wwwroot\Vega\xsl\aspose.xsl”);

pdfDoc.Save(@“C:\Data\aspose.pdf”);
}

When I break the execution, it actually puts the cursor on the closing bracket, so it’s not entirely clear where the error is occurring. If I do the transform in XML Spy, I get the following output (sorry if this is a really long post); I can’t really see how any of the tables contained in that XML would be too big for a PDF to handle. Is there something that I’m missing here? As an aside, you guys should really look into putting out some decent documentation on the XML side of the product, not just on the API.

Matt

<?xml version="1.0" encoding="UTF-8"?>



A?
Custom Data Feed
?is a compilation of data feeds to which a Gerson Lehrman Group client subscribes. Within each data feed group are indexes relating to a specific topic.
Gerson Lehrman Group continually captures data from The Council of Advisors to update its indexes. Index values should always be considered in conjunction with index volume. The volume measures
the number of Council Members that contributed to that particular index value. The index values are means unless otherwise specified. High and low values are dropped from all datasets. Index values
with volumes of less that 10 are not reported for that period. Please see the end of this report for other general information relating to the interpretation of these data.





test1









Index
Quick Description
Current
Last
Change
%
Volume


GLX4
Numeric Array Choice 22
3
3
0
0
N/A


GLX5
LS Checkbox x:one y:sometimes
NaN
NaN
NaN
NaN
N/A



My new Group









Index
Quick Description
Current
Last
Change
%
Volume


GLX4
Numeric Array Choice 22
3
3
0
0
N/A


GLX5
LS Checkbox x:one y:sometimes
NaN
NaN
NaN
NaN
N/A



Dear Matt,

A quick answer for:

As an aside, you guys should really look into putting out some decent documentation on the XML side of the product, not just on the API.

In the next release (available before mid-June), the API Reference will include XML examples for each class, in addition to C# and VB examples.

Thanks for your suggestion.

Your other issues will be addressed very soon. Thanks for your patience.

Dear Matt,

A quick answer for:

As an aside, you guys should really look into putting out some decent documentation on the XML side of the product, not just on the API.

In the Next release, available before mid-June, the API Reference will include XML examples for each class, in addition to C# and VB examples.

Thanks for your suggestion.

Your other issues will be addressed very soon. Thanks for your patience.


Dear Matt,

Cell.FitWidth is 100 by defult. So, if it is greater than 100 you need to explicityly set the value of Cell.FitWidth. Otherwise, Aspose.Pdf will throw “The table is too large” exception.

Please let me know what happens.

What does “100” a measure of exactly? Is it the width in pixels? If so, what happens if you have a cell that is going to have a fair amount of text inside and you just want it to wrap? As an example, I’m generating everything through an XSL, so I won’t neccessarily know how long the text is. Hence, I would have to set the widths of the columns proportionately (i.e. cell #1 is 25% of the table width, cell #2 50% and so on). If one cell’s text is longer than that cell’ FitWidth, will I get the “table is too large” exception or will the generator be smart enough to wrap the text (possibly with the IsWidthFitToContent set to false? It would be very difficult, if not impossible, using the Custom XML -> XSL -> Aspose XML model to figure out the longest string that will be in a cell and compute it’s width at runtime. That is, without possibly having to include a hack such as going through the custom XML before the transform and figuring out the widths of each string based on the font to be used (which should be included in the XSL) and modifying the custom XML before the XSL. Certainly, do to speed concerns, one would not want to have to include script within the transform.


Dear Mars,

We have reviewed your feedback as well as the chats via MSN and we have thought the problem may arise from inappropriate use of Aspose.Pdf.

So, would you like to email us a simple test case, including all necessary vb/c#/xml code, which can reproduce the problem? Then we will try to fix your sample code to avoid the problem.

Thanks for your cooperation.

Dear Matthew,

Thanks for your consideration.

After carefully studying your xml and xsl files we have found Cell Width must be enhanced in order to meet your needs.

I know this is a very urgent issue for you and I want you to understand that you’re very important to us. Since we have promised to deliver a hot fix for the font issue first, the fix for the cell width can be expected next week, after the fix for font issue.

I understand that this delay is a problem for you. As a remedy, could you postpone your client demostration, or, temporarily adjust the requirements to better utilize the current dll. I hope you are able to find a solution that will minimize the effect of the delay.



Hi Matthew,

1. Please check the latest hot fix for cell width issue.

2. If the length of the string is over the FitWidth of the cell the string will be wrapped automatically, connected with “-”. For example, “paragraph” may be wrapped to:

para-
graph

3. It will throw an exception if the FitWidth of the cell is too small to keep 2 characters.

4. Currently Aspose.Pdf supports fixed FitWidth only. It will support FitWidth adjustable with its contents.

5. The sample xml file you have provided now works.

<?xml version="1.0" encoding="utf-8" ?>
<Pdf xmlns=“Aspose.Pdf”
Title=“GLG Data Feeds” Author=“Aspose Support” Producer=“Aspose Pty Ltd”
Creator=“Aspose.Pdf.Demos” Subject=“Indexes” Keywords=“Pdf Aspose.Pdf
Indexes”>
<Section PageMarginLeft=“50” PageMarginRight=“50”
ID=“sectionIntro”>
<Text IsFirstParagraph=“true” FontName=“Times-Roman” FontSize=“15”
Color=“rgb 0 0 0” Alignment=“left”>
hhh

Custom Data Feed

hhh is a compilation of data feeds to which a Gerson Lehrman
Group client subscribes. Within each data feed group are indexes relating
to a specific topic.
Gerson Lehrman Group continually captures
data from The Council of Advisors to update its indexes. Index values
should always be considered in conjunction with index volume. The
volume measures
the number of Council Members that contributed to
that particular index value. The index values are means unless
otherwise specified. High and low values are dropped from all datasets. Index
values
with volumes of less that 10 are not reported for that
period. Please see the end of this report for other general information
relating to the interpretation of these data.




<Section PageMarginLeft=“50” PageMarginRight=“50”
ID=“sectionBody”>


test1












<Segment FontName=“Times-Bold”
FontSize=“11”>Index


<Cell
FitWidth=“300”>

<Segment FontName=“Times-Bold”
FontSize=“11”>Quick Description


<Cell
FitWidth=“25”>

<Segment FontName=“Times-Bold”
FontSize=“11”>Current





<Segment FontName=“Times-Bold”
FontSize=“11”>Last





Change





<Segment
FontName=“Times-Bold” FontSize=“11”>%





<Segment FontName=“Times-Bold”
FontSize=“11”>Volume







<Segment
FontName=“Times-Roman” FontSize=“11”>GLX4


<Cell
FitWidth=“300”>

<Segment FontName=“Times-Roman”
FontSize=“11”>Numeric Array Choice 22





<Segment FontName=“Times-Roman”
FontSize=“11”>3


<Cell
FitWidth=“25”>

<Segment FontName=“Times-Roman”
FontSize=“11”>3





0





<Segment
FontName=“Times-Roman” FontSize=“11”>0





<Segment
FontName=“Times-Roman” FontSize=“11”>N/A







<Segment
FontName=“Times-Roman” FontSize=“11”>GLX5





<Segment FontName=“Times-Roman”
FontSize=“11”>LS Checkbox x:one y:sometimes





<Segment
FontName=“Times-Roman” FontSize=“11”>NaN





<Segment FontName=“Times-Roman”
FontSize=“11”>NaN


<Cell
FitWidth=“25”>

<Segment FontName=“Times-Roman”
FontSize=“11”>NaN





NaN





<Segment
FontName=“Times-Roman” FontSize=“11”>N/A







My new Group














<Segment
FontName=“Times-Bold” FontSize=“11”>Index





<Segment
FontName=“Times-Bold” FontSize=“11”>Quick Description





<Segment
FontName=“Times-Bold” FontSize=“11”>Current





<Segment FontName=“Times-Bold”
FontSize=“11”>Last


<Cell
FitWidth=“25”>

<Segment FontName=“Times-Bold”
FontSize=“11”>Change





%





<Segment
FontName=“Times-Bold” FontSize=“11”>Volume








GLX4





<Segment
FontName=“Times-Roman” FontSize=“11”>Numeric Array Choice 22





<Segment
FontName=“Times-Roman” FontSize=“11”>3





<Segment
FontName=“Times-Roman” FontSize=“11”>3


<Cell
FitWidth=“25”>

<Segment FontName=“Times-Roman”
FontSize=“11”>0





0





<Segment
FontName=“Times-Roman” FontSize=“11”>N/A








GLX5





<Segment
FontName=“Times-Roman” FontSize=“11”>LS Checkbox x:one y:sometimes





<Segment
FontName=“Times-Roman” FontSize=“11”>NaN





<Segment
FontName=“Times-Roman” FontSize=“11”>NaN


<Cell
FitWidth=“25”>

<Segment FontName=“Times-Roman”
FontSize=“11”>NaN


<Cell
FitWidth=“25”>

<Segment FontName=“Times-Roman”
FontSize=“11”>NaN





N/A








I’ll begin testing the hotfix but, really, this solution will need to be modified eventually. In a situation where you’re wrapping text to fit a fixed width space, you shouldn’t assume that it should be broken within a word or, even if so, that that should be connected with a ‘-’ character. That is very culture specific and, also, may not neccessarily be appropriate for any give application. For example, in HTML, if something does fit within the width of a table cell, it wraps the text to a new line but based on words, not on the exact placement of individual characters within the cell. For example,

Your solution:

This is some t-
ext which nee-
ds to be wrap-
ped

HTML:

This is some
text which
needs to be
wrapped

In most circumstances, the second example would be the best way to tackle this. It is completely culture neutral and makes for much easier to read text. Furthermore, in subsequent releases, if you want a more saleable product, you need to plan for “nowrap” type columns (where the width will end up being the longest line of text in that column) as well as percentage based, or relative, cell widths.

I’ll let you know how the hotfix works.

Matt

Ok, the test case above works fine for me now, except for one annoying problem. While the library doesn’t throw an exception, the output is a little messed up. When the PDF is generated, after the first paragraph, the page breaks. So, most of the first page is empty, with the tables beginning to display on page #2. If you run the following XML through, you should be able to see the behavior I’m talking about.

<?xml version="1.0" encoding="UTF-8"?>



A?
Custom Data Feed

?is a compilation of data feeds to which a Gerson Lehrman Group client subscribes. Within each data feed group are indexes relating to a specific topic.
Gerson Lehrman Group continually captures data from The Council of Advisors to update its indexes. Index values should always be considered in conjunction with index volume. The volume measures
the number of Council Members that contributed to that particular index value. The index values are means unless otherwise specified. High and low values are dropped from all datasets. Index values
with volumes of less that 10 are not reported for that period. Please see the end of this report for other general information relating to the interpretation of these data.





test1











Index




Quick Description




Current




Last




Change




%




Volume






GLX4




Numeric Array Choice 22




3




3




0




0




N/A






GLX5




LS Checkbox x:one y:sometimes




NaN




NaN




NaN




NaN




N/A





My new Group











Index




Quick Description




Current




Last




Change




%




Volume






GLX4




Numeric Array Choice 22




3




3




0




0




N/A






GLX5




LS Checkbox x:one y:sometimes




NaN




NaN




NaN




NaN




N/A





Dear Matthew,

Thanks for your consideration.

In fact, When the string’s width is larger than the cell’s width, Aspose.Pdf will wrap the text to a new line based on words, not on the exact placement of individual characters within the cell.

But how can it do when the cell’s width is even smaller than a word’s width? There are two solution: one is to wrap the text based on characters and the other is to adjust cell width as you said. The later one may be a better solution,but we need more time to work it out. Currently Aspose.Pdf supports fixed FitWidth only.

I will test your new Xml file and give you feedback soon.

Dear Matthew,

Thanks for your consideration.

The page breaks after the first paragraph because you have used a new section. A new Section will begin with a new page.

Thanks, I’ll try not using separate elements then. So, a element always represents a new page?

Matt

Dear Matthew,

Thanks for your consideration.

Another way to begin a new page is to set the ‘IsFirstParagraph’ property of any paragraph to true. When a series of paragraphs share certain features, such as font or color, you can use a section to manage them. You simply set the properties of the section and you need not set the properties again in each and every paragraph.

Howver, when you use multiple sections, you are able to use different pagesizes and different ‘headerfooter’ properites.

I downloaded the latest hot fix (Date 6/10/2003 11:04 PM), and I still get this error. I purposely put too much text into the field because I want it to wrap.

When will this be fixed? Did the latest hot fix remove an earlier fix that was released?


(Moderators FYI: I tried replying to one of the other replies where this message would be more appropriate, but I was returned an aspx error stating that the pinned date could not be null)

Hi,


I downloaded the latest hot fix (Date 6/10/2003 11:04 PM), and I still get this error. I purposely put too much text into the field because I want it to wrap.


Would you like to post your vb/c#/xml code here?


When will this be fixed? Did the latest hot fix remove an earlier fix that was released?


The one you received is the latest hot fix. Yes, the latest one always overwrites the eariler one.


(Moderators FYI: I tried replying to one of the other replies where this message would be more appropriate, but I was returned an aspx error stating that the pinned date could not be null)


Please indicate which thread caused the error. The aspose.com portal and this forum are occasionally offline for several minutes at a time. I am reporting this problem to the ISP. If it does fail, please wait several minutes and then try again. Thanks for your tolerance.




The code I used was from the example under the “Cell” class in the help file. To reproduce the problem, I placed around 75+ characters of text in the Segement.Content, when the Cell.FitWidth was 100. I wanted the words to wrap on purpose.

As for the thread that caused the error, I’m sorry that I cannot remember which one it was.

Thanks for your reply,

A quick question:

Could you tell me if you’re using the latest fix; version number 1.0.1256.34276?

Yes, 1.0.1256.34276, is the version I have.