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 2015/02/23 08:41:13 UTC

[Bug 57618] New: How to set heading style for a paragraph in a docx file using Apache POI ?

https://bz.apache.org/bugzilla/show_bug.cgi?id=57618

            Bug ID: 57618
           Summary: How to set heading style for a paragraph in a docx
                    file using Apache POI ?
           Product: POI
           Version: 3.9-FINAL
          Hardware: PC
            Status: NEW
          Severity: critical
          Priority: P2
         Component: XWPF
          Assignee: dev@poi.apache.org
          Reporter: ffurkan.tanriverdi@gmail.com

I am trying to create a docx file with poi but I cannot set heading style for a
paragraph. My code structure is like below;

    XWPFDocument document= new XWPFDocument(); 

    //Write the Document in file system
    FileOutputStream out = new FileOutputStream(new
File("C:/Users/2/Desktop/RequirementModelDocument.docx"));

    XWPFParagraph paragraph = document.createParagraph();
    XWPFRun run=paragraph.createRun();


    paragraph.setAlignment(ParagraphAlignment.LEFT);
    paragraph.setStyle("Heading1");    // not working

    run.setText(reqLevel.getName());
    run.setBold(true);
    run.setFontFamily("Calibri Light (Headings)");


Its like ignores the paragraph.setStyle("Heading1"); line. I've looked at the
apache's examples but I could not see any. 

regards

-- 
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 57618] How to set heading style for a paragraph in a docx file using Apache POI ?

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

--- Comment #2 from Nick Burch <ap...@gagravarr.org> ---
If you'd like to write this us as an Example, which we can then ship with POI
to help others in future, we'd love to have your contribution!

-- 
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 57618] How to set heading style for a paragraph in a docx file using Apache POI ?

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

furkan <ff...@gmail.com> changed:

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

-- 
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 57618] How to set heading style for a paragraph in a docx file using Apache POI ?

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

furkan <ff...@gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 OS|                            |All

--- Comment #1 from furkan <ff...@gmail.com> ---
I found a solution in the link below

http://stackoverflow.com/questions/2643822/how-can-i-use-predefined-formats-in-docx-with-poi


But If you have another solution without using template file, please let me
know :))

regards

-- 
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 57618] How to set heading style for a paragraph in a docx file using Apache POI ?

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

furkan <ff...@gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|RESOLVED                    |CLOSED

--- Comment #3 from furkan <ff...@gmail.com> ---
OK. What should I do to do so ?

-- 
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