You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@poi.apache.org by bu...@apache.org on 2013/11/20 15:53:01 UTC

[Bug 55802] New: Special Letters not exported correct

https://issues.apache.org/bugzilla/show_bug.cgi?id=55802

            Bug ID: 55802
           Summary: Special Letters not exported correct
           Product: POI
           Version: 3.9
          Hardware: PC
            Status: NEW
          Severity: normal
          Priority: P2
         Component: XWPF
          Assignee: dev@poi.apache.org
          Reporter: tp@klar-partner.de

i am creating a document in that way:

XWPFRun aktRun = aktpara.createRun();
aktRun.setText(textA);
aktRun.setBold(aktBold);
aktRun.setItalic(aktItalic);
aktRun.setFontFamily(aktFont);
aktRun.setFontSize(aktSize);

My textA-String includes german words which has 'ä, ü, ß or ö' inside. When
writing the document i have a wrong font inside the words. It use the Calibri
Font instead of the Font of the other letters of the word at that position. The
size and the other attributes are all right, only the font is wrong.

-- 
You are receiving this mail because:
You are the assignee for the bug.
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@poi.apache.org
For additional commands, e-mail: dev-help@poi.apache.org


[Bug 55802] [PATCH] Special Letters not exported correct

Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=55802

Andreas Beeker <an...@gmx.de> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|REOPENED                    |RESOLVED
         Resolution|---                         |FIXED

--- Comment #12 from Andreas Beeker <an...@gmx.de> ---
Patch applied with r1563496.

-- 
You are receiving this mail because:
You are the assignee for the bug.

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@poi.apache.org
For additional commands, e-mail: dev-help@poi.apache.org


[Bug 55802] Special Letters not exported correct

Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=55802

--- Comment #6 from tp@klar-partner.de ---
And yes, the file includes: <?xml version="1.0" encoding="UTF-8"?>
<w:document
xmlns:w="http://schemas.openxmlformats.org/wordprocessingml/2006/main"><w:body><w:p><w:r><w:rPr><w:rFonts
w:ascii="Arial"/><w:sz w:val="22"/></w:rPr><w:t>Ort, Datum der Erstellung:
Kornelimünster, am 8. November 2013</w:t></w:r></w:p></w:body></w:document>

So it seems its something else which is saved incorrect.

-- 
You are receiving this mail because:
You are the assignee for the bug.
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@poi.apache.org
For additional commands, e-mail: dev-help@poi.apache.org


[Bug 55802] Special Letters not exported correct

Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=55802

--- Comment #8 from Andreas Beeker <an...@gmx.de> ---
The above example works ok in Libre Writer and Windows Wordpad, but MS Word
(Viewer) seem to need the hAnsi attribute to be set: [1]

So as a temporary workaround, you'll need to write to the xmlbeans directly:

run.setText("Ort, Datum der Erstellung: Kornelimünster, am 8. November 2013");
run.setFontFamily("Times New Roman");
run.getCTR().getRPr().getRFonts().setHAnsi("Times New Roman");
run.setFontSize(50);


[1] http://officeopenxml.com/WPtextFonts.php

-- 
You are receiving this mail because:
You are the assignee for the bug.
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@poi.apache.org
For additional commands, e-mail: dev-help@poi.apache.org


[Bug 55802] Special Letters not exported correct

Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=55802

--- Comment #5 from tp@klar-partner.de ---
Thank you for the answer. I used your code to create a test-document.
Exactly the same error happens. The letter 'ü' ist Calibri, the rest is Arial.

I wonder, if its correct at you ?!

-- 
You are receiving this mail because:
You are the assignee for the bug.
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@poi.apache.org
For additional commands, e-mail: dev-help@poi.apache.org


[Bug 55802] Special Letters not exported correct

Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=55802

--- Comment #7 from tp@klar-partner.de ---
May i get some help? It is very important for my Project that this works fine.
thank you in advance

-- 
You are receiving this mail because:
You are the assignee for the bug.

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@poi.apache.org
For additional commands, e-mail: dev-help@poi.apache.org


[Bug 55802] Special Letters not exported correct

Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=55802

--- Comment #4 from Andreas Beeker <an...@gmx.de> ---
You probably need to show more of your code and/or explain how you get the
input data - with a simple test, this can't be reproduced:


public void testUmlaut() throws Exception {
    XWPFDocument doc = new XWPFDocument();
    XWPFRun run = doc.createParagraph().createRun();
    run.setText("Ort, Datum der Erstellung: Kornelimünster, am 8. November
2013");
    run.setFontFamily("Arial");
    run.setFontSize(11);
    OutputStream os = new FileOutputStream("umlaut.docx");
    doc.write(os);
    os.close();
}

... doesn't generate any other textrun elements in the docx:

<w:p><w:r><w:rPr><w:rFonts w:ascii="Arial"/><w:sz w:val="22"/></w:rPr><w:t>Ort,
Datum der Erstellung: Kornelimünster, am 8. November 2013</w:t></w:r></w:p>

My guess is, that you are converting from old doc to docx format and while
reading the input file, you are already receiving broken textruns.

-- 
You are receiving this mail because:
You are the assignee for the bug.
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@poi.apache.org
For additional commands, e-mail: dev-help@poi.apache.org


[Bug 55802] Special Letters not exported correct

Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=55802

tp@klar-partner.de changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEEDINFO                    |RESOLVED
         Resolution|---                         |FIXED

--- Comment #10 from tp@klar-partner.de ---
Many thanks Andreas,
finally it works.

-- 
You are receiving this mail because:
You are the assignee for the bug.

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@poi.apache.org
For additional commands, e-mail: dev-help@poi.apache.org


[Bug 55802] Special Letters not exported correct

Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=55802

Andreas Beeker <an...@gmx.de> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|RESOLVED                    |REOPENED
         Resolution|FIXED                       |---

--- Comment #11 from Andreas Beeker <an...@gmx.de> ---
I haven't committed the patch yet, so I mark it as reopened.

-- 
You are receiving this mail because:
You are the assignee for the bug.

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@poi.apache.org
For additional commands, e-mail: dev-help@poi.apache.org


[Bug 55802] Special Letters not exported correct

Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=55802

--- Comment #9 from Andreas Beeker <an...@gmx.de> ---
Created attachment 31271
  --> https://issues.apache.org/bugzilla/attachment.cgi?id=31271&action=edit
[PATCH] add default font ranges

This patch sets the font family of other font ranges to a default value if not
they aren't specified explicitly.

(... to be applied when POI 3.10 final is released ...)

-- 
You are receiving this mail because:
You are the assignee for the bug.

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@poi.apache.org
For additional commands, e-mail: dev-help@poi.apache.org


[Bug 55802] Special Letters not exported correct

Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=55802

--- Comment #3 from tp@klar-partner.de ---
Sorry to answer that late. My Problem is still very important for me to get
solved. In the Attachement you can see the Problem.
When i open my generated file with Word (or open Office should be the same) i
get everything in the right font (the font i used in the Java Project).
But all the Special letters like ü,ö,ä,ß uses the Font 'Calibri'. Whats wrong
there, i know These letters also exist in the other Fonts. Everything works,
the underline, italic, bold, fontsize, but only the font is different there. I
hope my Infos are now enough, otherwise i can Show you more sourcetext, but it
doesnt seem it is because of that! Thank you already:)

-- 
You are receiving this mail because:
You are the assignee for the bug.
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@poi.apache.org
For additional commands, e-mail: dev-help@poi.apache.org


[Bug 55802] [PATCH] Special Letters not exported correct

Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=55802

Andreas Beeker <an...@gmx.de> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
            Summary|Special Letters not         |[PATCH] Special Letters not
                   |exported correct            |exported correct

-- 
You are receiving this mail because:
You are the assignee for the bug.

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@poi.apache.org
For additional commands, e-mail: dev-help@poi.apache.org


[Bug 55802] Special Letters not exported correct

Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=55802

--- Comment #2 from tp@klar-partner.de ---
Created attachment 31105
  --> https://issues.apache.org/bugzilla/attachment.cgi?id=31105&action=edit
Bug

-- 
You are receiving this mail because:
You are the assignee for the bug.

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@poi.apache.org
For additional commands, e-mail: dev-help@poi.apache.org


[Bug 55802] Special Letters not exported correct

Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=55802

Nick Burch <ap...@gagravarr.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |NEEDINFO
                 OS|                            |All

--- Comment #1 from Nick Burch <ap...@gagravarr.org> ---
I'm not quite understanding the problem. Any chance you can create a short
junit unit test that shows the problem?

-- 
You are receiving this mail because:
You are the assignee for the bug.

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@poi.apache.org
For additional commands, e-mail: dev-help@poi.apache.org