getText with styles

Previous topic - Next topic

superspy

Hi

I'm trying to use the getAllText() function to get the text from a frame and put it into another document.
It works, BUT...formatting is lost. Is there a way to preserve formatting?

Or alternatively is there a way to copy an entire text box with styling via a script.

Thanks in advance

ismir

Hi,

you can use getFont (in a while loop through all the textframes where you get the text with getText)


font = scribus.getFont(item[0])


and when you paste your collected text in a single textframe use


scribus.setText(my_collected_text_var, item[0])
scribus.setFont(font, item[0])


item in this example is the varible given from scribus.getPageItems()
the items are textframes when item[1] == 4

regards