Table Cell Padding

Previous topic - Next topic

sbus-scripter

I'm trying to set table cell padding with API but it not setting it. Script runs without an error but no changes are being made.

I am using setCellLeftPadding and values I'm passing are below where I have named my table as mytable
scribus.setCellLeftPadding(1, 1, 0.15, "mytable")
TIA


a.l.e

works here... but, depending on your default unit, you want to use a bigger value than 0.15...

with 0.15 i just see a small flicker (here it moves by one and a half millimeters...)

put 20 in there and you will see something : - )

if it's not one of the scripter's functions that has been fixed recently, it should also work for you!

sbus-scripter

Thank you for the reply. I tried with 0.5 but it still doesn't work. I would expect the value to be updated even the value is small. BTW I am using inches as my units.

My expected behavior is for the following value 'Left' to be updated but it is staying at zero.



Scribus: version 1.6.1
OS: MacOS Sonoma 14.2.1

a.l.e

a few remarks from my side:

- (1, 1) is not the first cell in the table, but the second column and second row (so you need at least two columns and two rows to see something)
- as far as i can tell, there is no way to see (or set) the padding in the UI (the cell padding is for sure not the value in the "column & text distances" of the text properties).
- i have no idea how big 0.5 inch is, but, don't be stingy: put a nice 2 in there and see what happens! (i think that inches are in same order of magnitude as centimeters...)

here it works, and if you don't get any error message, i guess that it's also working on your computer and you might simply be looking at the wrong place...

AdmFubar

Quote from: a.l.e on February 27, 2024, 10:18:59 PMa few remarks from my side:

- (1, 1) is not the first cell in the table, but the second column and second row (so you need at least two columns and two rows to see something)
- as far as i can tell, there is no way to see (or set) the padding in the UI (the cell padding is for sure not the value in the "column & text distances" of the text properties).
Uhm yes it is. The cell padding can be adjusted via the UI. It isnt applied until there is actual text is placed in the cell. If all you have is the cursor in the cell it isnt moved in place till you insert some actual text.
Using Scribus 1.6.1, openSUSE 15.5
Advanced hobbyist

sbus-scripter

#5
Thank you very much to a.l.e & AdmFubar for your inputs/suggestions/help.

So my understanding was incorrect with the padding parameter. I thought padding value is same units as the document, which is not the case here. As a.l.e suggested I used 20 padding value and I can surely see the change.

Another mistake I was doing was trying to verify the change with the UI because I thought Left in "column & text distances" properties is what I was setting which is different setting from what I was setting.


Is it possible to change the cells "column & text distances" properties from the API? this was my initial attempt. Table/cells have very limited api calls. I think they are grouped textframes so I'm assuming if I can get a handle of the cell from the API I should be able to make this changes using the textframe APIs.

Also can I change the cell text style from the API?

Sorry for the loaded question.


setCellLeftPadding(1, 1, 20)

AdmFubar

Not certain about the API being able to change the text styles. (no first hand experience), but from looking over the api calls it looks doable. would be a matter of getting the desired cell selected and applying text styles, iterating through the cells as needed.
While the cels appear as text frames grouped together, I've noticed that the story editor isnt available to edit the text contained in them. This may be to keep from adding text beyond the size allotted in the cell. Might be a parameter to keep in mind when adding text to a cell from a script.
Using Scribus 1.6.1, openSUSE 15.5
Advanced hobbyist