View Issue Details

IDProjectCategoryView StatusLast Update
0014453ScribusScripterpublic2016-12-14 00:00
Reportergpittman Assigned To 
Status newResolutionopen 
Product Version1.5.3.svn 
Target VersionFixed in Version 
Summary0014453: Scripter command setStyle() doesn't work
DescriptionsetStyle() is supposed to change the Paragraph Style of text in a selected or named frame.
If text is not selected, it should set the style for the entire frame. It doesn't.
Steps To ReproduceMake a document with a text frame, enter or load some text.
Create a Paragraph Style with a particular NAME.
Select the frame, run the uploaded script (the script is designed to work on one or more selected frames).
Enter the NAME of the Style in the valueDialog which appears.

Result: typically there will be some assignment of the style but not the entire frame. It seems that only the last paragraph will have a change in style.

Another curious feature is that if you select and delete the last paragraph, the last paragraph remaining will change to the assigned style.
TagsNo tags attached.


related to 0008957 assignedjainbasil [patch] Add setTextPreserveStyle() that wont default back to the default style. (Silimar to Scribus 1.3.3 setText) 
related to 0009273 acknowledged Additional scripter methods for paragraph and style handling 



2016-12-11 20:18

developer (1,516 bytes)


2016-12-13 23:45

developer (1,625 bytes)


2016-12-13 23:47

developer   ~0042972

I've uploaded another version of the script, which attempts to select all the text in the frame, but still only part of the text had the style changed. In a 3-paragraph portion of text, only the middle paragraph had the style changed.


2016-12-13 23:51

developer   ~0042973

Last edited: 2016-12-13 23:56

View 2 revisions

Here is an excerpt from cmdobj.cpp, beginning at line 622, that seems to be the actual point of application of the style, after various error checks:

        // for current item only
        if (ScCore->primaryMainWindow()->doc->m_Selection->count() == 0 || (strlen(name) > 0))
            // quick hack to always apply on the right frame - pv
            //CB I dont think we need to draw here. Its faster if we dont.
            ScCore->primaryMainWindow()->view->SelectItem(item, false);
            // Now apply the style.
            int mode = ScCore->primaryMainWindow()->doc->appMode;
            ScCore->primaryMainWindow()->doc->appMode = modeEdit;
            ScCore->primaryMainWindow()->doc->appMode = mode;

I don't know why this isn't working but it obviously isn't.

I tried changing the bool values to the opposite, but this made no difference.


2016-12-14 00:00

developer   ~0042976

If I run the script with the frame in Edit Contents mode, the paragraph style is applied to the paragraph where the cursor is.

Issue History

Date Modified Username Field Change
2016-12-11 20:17 gpittman New Issue
2016-12-11 20:18 gpittman File Added:
2016-12-11 21:04 Kunda Relationship added related to 0008957
2016-12-11 21:07 Kunda Relationship added related to 0009273
2016-12-13 23:45 gpittman File Added:
2016-12-13 23:47 gpittman Note Added: 0042972
2016-12-13 23:51 gpittman Note Added: 0042973
2016-12-13 23:56 gpittman Note Edited: 0042973 View Revisions
2016-12-14 00:00 gpittman Note Added: 0042976