Bug 79959

Summary: FILEOPEN: RTF Extra space in the style name
Product: LibreOffice Reporter: Urmas <davian818>
Component: filters and storageAssignee: Miklos Vajna <vmiklos>
Status: RESOLVED FIXED QA Contact:
Severity: minor    
Priority: medium CC: barta, marina, vmiklos
Version: 4.1.5.3 release   
Hardware: Other   
OS: All   
Whiteboard: filter:rtf target:4.4.0
i915 platform: i915 features:
Bug Depends on:    
Bug Blocks: 81234    
Attachments: Example

Description Urmas 2014-06-12 23:23:02 UTC
If there is several spaces between style definition and style name in RTF style table, the imported style name will have extra spaces in the beginning.
Word imports those normally.
Comment 1 Marina Latini 2014-07-23 11:08:01 UTC
Hi, 
Can you explain the steps for reproduce the problem?
Comment 2 Urmas 2014-07-23 11:52:23 UTC
Created attachment 103332 [details]
Example
Comment 3 Marina Latini 2014-07-23 17:21:54 UTC
Hi,
I can't reproduce the problem on LibO:
* Version: 4.4.0.0.alpha0+
* Build ID: 4ca819b204e6c93c4b4e20b191100aa248b8ff23
* TinderBox: Linux-rpm_deb-x86_64@46-TDF, Branch:master, Time: 2014-07-22_23:53:50
* OS: Ubuntu 14.04 x86_64

Can you provide a step by step procedure? Can you specify your system and your LibreOffice version?

Your attachment 103332 [details] has a "test" style with one blank space at the beginning but I can't create a second one with the same problem.
Comment 4 Urmas 2014-07-23 17:34:15 UTC
> has a "test" style with one blank space at the beginning

So you can reproduce it.
Comment 5 Marina Latini 2014-07-23 17:37:45 UTC
(In reply to comment #4)
> 
> So you can reproduce it.

Opening your file I can see the test style with one blank space at the beginning but I can't create this kind of style.
Comment 6 tommy27 2014-07-24 09:19:18 UTC
I'm reverting status to NEEDINFO since we need exact step-by-step procedure to exactly reproduce your bug.

also give details about O/S and other stuff like asked by Marina
Comment 7 tommy27 2014-07-24 09:41:49 UTC
also tell if the issue was present or not in previous LibO release or if it's specific to 4.4.x master branch
Comment 8 Urmas 2014-07-24 11:08:03 UTC
Confirming as per Comment 3.
The bug is about opening RTF files, as evident per Comment 1.
This bug is not in OpenOffice.
Comment 9 Marina Latini 2014-07-24 12:23:01 UTC
Hi Urmas,
Your attachment 103332 [details] has a buggy style name but I can create a new one style with the same behaviour.
Please, can you write a step by step procedure to create a new buggy style?
Which LibreOffice version are you using? 
I'm testing on Ubuntu 14.04 x86_64 and I see your "test" style but I can't create a new one with blank space at the beginning. 
Are you testing on Windows or Mac?
Comment 10 Urmas 2014-07-24 12:29:50 UTC
Are you dyslexic? Opening that files SHOULD NOT create a style name with spaces.
Whether you can or cannot create such a style is not related to this bug.
Comment 11 tommy27 2014-07-24 12:42:36 UTC
@Urmas
besides being rude with a lady, would you please reply to the simple question about you O/S that has been already asked to you 3 times?
Comment 12 Marina Latini 2014-07-24 16:16:14 UTC
Urmas,
this is the source code of your rtf file:
{\rtf1\ansi\ansicpg1251\deff0\deflang1049{\fonttbl{\f0\fnil\fcharset0 Calibri;}}
{\stylesheet{\s0  Test;}}
\viewkind4\uc1\pard\s0\slmult1\lang9\f0\fs22 Hello world!\par
}

Reading the code, it seems to be a "handmade" document.
In any case, LibreOffice add the extra blank space at the beginning of the style name.

I can't test with MS Office but AOO trims the extra blank spaces.
AOO version:
* AOO411m3(Build:9772) - Rev. 1611634
* 2014-07-18 15:06 - Linux x86_64

All the tested (LibO's) versions have the same behaviour (extra spaces not trimmed):

* Version: 4.4.0.0.alpha0+
* Build ID: 3fdd4f069d5436cf39708004af7fda8175fbc4c2
* TinderBox: Linux-rpm_deb-x86_64@46-TDF, Branch:master, Time: 2014-07-09_02:51:53

* Version: 4.1.5.3
* Build ID: 1c1366bba2ba2b554cd2ca4d87c06da81c05d24

* Version: 4.1.6.2
* Build ID: 40ff705089295be5be0aae9b15123f687c05b0a

* Version: 4.2.5.2
* Build ID: 61cb170a04bb1f12e77c884eab9192be736ec5f5

* Version: 4.3.0.3
* Build ID: 08ebe52789a201dd7d38ef653ef7a48925e7f9f7

According to my tests --> Version sets to 4.1.5.3
@Miklós: what's the right behaviour?
Comment 13 Miklos Vajna 2014-08-29 15:38:18 UTC
Word also strips the whitespace around the style name, so we should, too.
Comment 14 Commit Notification 2014-08-29 16:35:01 UTC
Miklos Vajna committed a patch related to this issue.
It has been pushed to "master":

http://cgit.freedesktop.org/libreoffice/core/commit/?id=305ecd1848a802a6c43ecc6e76f4c6bc36a03418

fdo#79959 RTF import: trim whitespace around style names



The patch should be included in the daily builds available at
http://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More
information about daily builds can be found at:
http://wiki.documentfoundation.org/Testing_Daily_Builds
Affected users are encouraged to test the fix and report feedback.

Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.