0

I understand that table and cells are supported only in PDFClown version 2.0 but that is only a few months away. So, being stuck with version 1.2, how do I create a spreadsheet having 2 columns (& another spreadsheet having 3 columns)?

Anything with examples to point me in the right direction.

fletchsod
  • 3,560
  • 7
  • 39
  • 65

1 Answers1

0

As you noticed, the layout engine supporting tables and lots of other high-level typographic elements is scheduled for 0.2.0 (its Java implementation will be pre-released for evaluation and beta-testing); in the meantime you can coarsely arrange a table this way:

  1. define the table partition (columns) on the page and draw the corresponding rectangles through the PrimitiveComposer;
  2. insert in each column area your contents through BlockComposer, keeping track of the maximum y occupied by your contents (this is calculated when you call BlockComposer.End(), after which you can retrieve the bounding box of your contents via BlockComposer.BoundBox);
  3. when you complete the columns for the current table row, use the maximum y saved in step 2 to draw the bottom line which closes the row and iterate back to step 2 until you run out of rows;
  4. if you run out of space while inserting contents, keep track of the positions returned by BlockComposer.ShowText() and BlockComposer.ShowXObject(): this way you can fill each column, then move to the next page and resume the insertion according to the tracked positions.

This should suffice to get the job done. ;-)

  • Based on your `Answer` description, I found this example in `*\dotNET\pdfclown.samples.cli\src\org\pdfclown\samples\cli\TypesettingSample.cs`, hope it is sufficient enough to use while learning with trials & errors. – fletchsod Mar 23 '15 at 14:21
  • Regarding Java implementation for pre-release for evaluation & beta-testing, so there wouldn't be a C# version for that? – fletchsod Mar 23 '15 at 14:22
  • @fletchsod C# version will come during summer. – Stefano Chizzolini Mar 23 '15 at 19:10