Create table block wih Java

  • 11 Views
  • Last Post 3 days ago
  • Topic Is Solved
FaL keN posted this 4 days ago

Hello,

How can I create table with Java (table with much cells). I use FRE12 for Linux.

I need to set manually where the specific column is.

Thank you.

Order By: Standard | Newest | Votes
Nadezhda A. Solovyeva posted this 3 days ago

Hello

Here is how to create a table. Please use the code below instead of Document.Process()

ILayout layout = document.getPages().getElement(0).getLayout();
IRegion tableRegion = engine.CreateRegion();
tableRegion.AddRect(0, 0, 500, 500);
IIntsCollection horzSeparators = engine.CreateIntsCollection();
horzSeparators.Add(100);
horzSeparators.Add(200);
horzSeparators.Add(300);
horzSeparators.Add(400);
IIntsCollection vertSeparators = engine.CreateIntsCollection();
vertSeparators.Add(250);
ITableBlock tableBlock = layout.getBlocks().AddNew(BlockTypeEnum.BT_Table, tableRegion, -1).GetAsTableBlock();
tableBlock.InitializeGrid(horzSeparators, vertSeparators); // create table with 2 columns: at 0px and at 250px
// and 5 rows, each of 100 px height
document.Recognize(null, null);
document.Synthesize(null);

 

FaL keN posted this 3 days ago

Hello Nadezhda,

Thank you for answer.

Close