Scribus Forums

Scribus => Scripts and Plugins => Topic started by: superspy on January 30, 2014, 11:12:54 am

Title: getText with styles
Post by: superspy on January 30, 2014, 11:12:54 am
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
Title: Re: getText with styles
Post by: ismir on April 07, 2014, 02:01:28 am
Hi,

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

Code: [Select]
font = scribus.getFont(item[0])

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

Code: [Select]
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