Bug 111921 - Support Paragraph Styles on the Text inside of Textboxes
Summary: Support Paragraph Styles on the Text inside of Textboxes
Status: NEW
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: Writer (show other bugs)
(earliest affected)
Inherited From OOo
Hardware: All All
: medium enhancement
Assignee: Not Assigned
: 107963 130923 (view as bug list)
Depends on:
Blocks: Textbox Writer-Styles
  Show dependency treegraph
Reported: 2017-08-20 00:50 UTC by Alexandre Leclerc
Modified: 2024-06-05 14:17 UTC (History)
11 users (show)

See Also:
Crash report or crash signature:


Note You need to log in before you can comment on or make changes to this bug.
Description Alexandre Leclerc 2017-08-20 00:50:53 UTC

When creating a textbox, and applying a character style to the text in the textbox, the style is applied, but "copied" since Libre Office will create an "automatic-styles" in content.xml instead of using the one describe in styles.xml.

It would have been intended to have the proper "style-name" from styles.xml appear in the "span" node instead of an "automatic-style" which is not even indicating it's parent-style-name.

The other solution would be to at least have the parent-style-name set properly in the automatic-style for such a case. So there is a way to know the textbox characters are using a user-defined style.

(This "bug" prevents external softwares analyzing content.xml to understand that there is a logical relation between the style applied on the text in the text-box and the style sheet.)

Thank you very much and have a nice day!

Steps to Reproduce:
1. Create a character style with "MyCharacterStyle" with bold.
2. Create a textbox (not a text frame) and add "ABC" as text.
3. Select the text in the textbox and apply the character style "MyCharacterStyle".
4. Save, close, open the document. The style is no more selected.
5. Open the source file in content.xml, you see the span uses an automatic-style.
6. Go check the automatic-style, the parent-style-name is not even given.

Actual Results:  
in content.xml you see the span node containing the "ABC" text has an automatic-style instead of "MyCharacterStyle". The automatic-style also does not have any parent-style-name.

Expected Results:
The span node containing the "ABC" text should use the "MyCharacterStyle" defined in styles.xml.

If an automatic-style must be created, the parent-style-name should make a reference to "MyCharacterStyle" from styles.xml.

Reproducible: Always

User Profile Reset: No

Additional Info:

User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/60.0.3112.101 Safari/537.36
Comment 1 Regina Henschel 2017-08-20 19:36:03 UTC
How do you create a "textbox"? If I use the "T" symbol, LibreOffice creates a shape and there is no possibility to assign a character style for text inside this shape.
Comment 2 Alexandre Leclerc 2017-09-04 16:09:40 UTC

I used the “T” symbol, indeed. And I just remarked that indeed it is impossible to apply a style.

But when I made my first experiments, I did not apply the style. In fact I copied and pasted already styled characters into the textbox. The formatting was kept, etc.

So to reproduce the behaviour:
1. Type “ABC” in the main editor.
2. Apply character formatting to it.
3. Create the textbox (T icon in the insert menu)
4. Copy the ABC in the main text and paste it into the textbox.

The same character formatting is kept, but there is now a disconnection between the character and the style.

Now I understand this it is probably not meant to behave like that, but I would certainly have appreciated it.

Thank you and best regards!
Comment 3 Buovjaga 2017-09-09 18:17:28 UTC
Pinging UX team: I tried to find a feature request for enabling text styles in Textboxes, but nothing came up. Have you ever discussed it? I did find reports urging to disable style controls context-sensitively.

I found I had carelessly accepted bug 96706 as NEW in 2015.

Bug 37511 is also related.
Comment 4 Heiko Tietze 2017-09-10 08:27:37 UTC
Pasting a character styled text into a box leads in fact to some trouble. It is saved like this

<style:style style:name="T1" style:family="text">
   <style:text-properties fo:font-variant="small-caps" fo:color="#008080"...
   <text:p text:style-name="P3"><text:span text:style-name="T1">He heard quiet steps behind him.</text:span></text:p>

Calligra opens this document and allows to set both paragraph and character style in text boxes. Alternatively, we could apply the default character style before pasting. But why do we restrict the formatting in objects (we do not talk about text box only but also shapes)?
Comment 5 Luke 2018-04-06 16:39:38 UTC
The heart of this problem is that LO lacks the ability to set paragraph styles on the text inside of graphical objects such as shapes and textboxes. When that issue is addressed this problem will be resolved with it. 

We either need to file a new bug for that or focus this bug report on that bigger issue.
Comment 6 Heiko Tietze 2018-04-07 09:54:16 UTC
If there is no limitation from the format (Regina?) and no compatibility restrictions, this could be implemented easily (at least regarding the UI). Otherwise WONTFIX.

Don't see need for input from UX.
Comment 7 Luke 2018-04-07 17:31:27 UTC
(In reply to Heiko Tietze from comment #4)
> But why do we restrict the formatting in objects (we
> do not talk about text box only but also shapes)?

I have found that historically we have restricted text box functionality to match that of MSO. By limiting our functionality to those MSO provided at the time, we avoided conversion errors when exporting to their format. Over the years MSO text box functionality has evolved, while we have maintained many of the old limitations. 

Here is a chart showing how text frames(pre-2000) have evolved to text boxes(2000-2007) which evolved to shape textboxes (2010). 


From that chart and my own testing, both the OOXML and the binary MS-DOC format now support text boxes with styles.
Comment 8 Regina Henschel 2018-11-22 20:37:23 UTC
There exists no format reason. LibreOffice could immediately implement that feature, totally in existing ODF format, without any need to use private namespace. And the fact, that a feature is missing in MS Office should never be a reason to not implement that feature in LibreOffice. What is bad in becoming better than MS Office?

Perhaps implementing user defined paragraph and character styles for the shape "Text box" is a topic for a GSoC project?
Comment 9 Regina Henschel 2018-11-22 20:41:28 UTC
*** Bug 107963 has been marked as a duplicate of this bug. ***
Comment 10 V Stuart Foote 2020-02-25 17:58:08 UTC
*** Bug 130923 has been marked as a duplicate of this bug. ***
Comment 11 Regina Henschel 2020-09-13 21:12:11 UTC
Bug 40871 is the similar request for text boxes in Draw/Impress.
Comment 12 Eyal Rozenberg 2022-12-19 21:41:54 UTC
I think we may want to have a meta-bug for "Support another styles of kind X in module Y".