Scribus Forums

Scribus => Scripts and Plugins => Topic started by: tanzeem on March 24, 2025, 07:54:31 AM

Title: Adjusting Table to Frame through Scripter API
Post by: tanzeem on March 24, 2025, 07:54:31 AM
I have created tables using Python Scripter API on Scribus1.6.2
Now i need help regarding adjusting table to frame. For my code:
      table = scribus.createTable(start_x, start_y, width, estimated_height, rows, cols, table_name)
with the script I also inserted content to cell, adjusted cellwidth/cellheight based on content and applied styles.
but found that manual adjustment of fitting table to frame and adjusting rowheight,column width is still needed.
Now i want this table to fit to frame using scripter api. Since i could not find the method in the web documentation. Also Scribus Desktop Help doesnt have tables documented.
How will i do it. When i did ripgrep, on the sourcecode i got:
  table->adjustTableToFrame();
How can i use this in the scribus script anyway.
Title: Re: Adjusting Table to Frame through Scripter API
Post by: a.l.e on March 24, 2025, 09:59:25 PM
I've created a table with the UI.

I've found the commands "adjust table to frame" and "adjust frame to table" but I could not see any changes and I'm still wondering what they do.

In the scripter both commands are called when creating a table but there is no way to trigger them.
This having been said, it should be pretty easy to expose them.

But what are they doing?
Title: Re: Adjusting Table to Frame through Scripter API
Post by: tanzeem on March 26, 2025, 06:39:09 AM
when creating table the table frame could be larger than the table. In this case when i do "Adjust Table to Frame", the table resizes itself and fits it to the frame-size. In my case the table was small and had many crossed boxes indicating cell content overflows when i had actually tried to calculate the column widths based on the content, and applied the col widths to the table using
scribus.resizeTableColumn(col_idx, width, table)And I have to do "Adjust Table to Frame" to finally fit the table to frame, whose width/height were calculated correctly by me.