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 2012/05/28 09:31:48 UTC

[Bug 53308] New: How to produce content with alignment from source document to destination document

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

          Priority: P2
            Bug ID: 53308
          Assignee: dev@poi.apache.org
           Summary: How to produce content with alignment from source
                    document to destination document
          Severity: major
    Classification: Unclassified
                OS: Windows XP
          Reporter: jeyasri021291@gmail.com
          Hardware: PC
            Status: NEW
           Version: 3.8
         Component: HWPF
           Product: POI

Hi,

I'm facing problem with alignment when I read a source document(source.doc) to
write a new document(new doc) with same content in multiple page.It is not come
with source document(source.doc) alignment. I'm struggling on that for a past
week. 

Can you please send me, how to resolve that?

My code is here,

     WordExtractor extractor = null;


     File file = new File("C:\\source.doc");
      POIFSFileSystem fs = new POIFSFileSystem(new FileInputStream(file));
      HWPFDocument doc = new HWPFDocument(fs);
      HWPFDocument finalDoc = new HWPFDocument(fs);
      Range range = finalDoc.getRange();
      extractor = new WordExtractor(doc);

         String paragraphs[]=extractor.getParagraphText();
         int paragraphsLength=paragraphs.length;
         paragraphsLength=paragraphsLength-1;
         Paragraph par1 = range.insertAfter(new ParagraphProperties(),0);
      for (int i=0; i<=4; i++)
      {   

      for (int j=0; j < paragraphs.length; j++){
        Paragraph p=range.getParagraph(j);
        String para1=paragraphs[paragraphsLength-j];

      if(p.getJustification()==0){

        par1.setJustification((byte) 0);

      }else if(p.getJustification()==2){

        par1.setJustification((byte) 2);
         }
         par1.insertBefore( para1);
      }
      }
      OutputStream out = new FileOutputStream(new File("C:\\new.doc"));
      finalDoc.write(out);
      out.flush();
      out.close();



Thanks 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 53308] How to produce content with alignment from source document to destination document

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

jeyasri021291@gmail.com changed:

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

-- 
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 53308] How to produce content with alignment from source document to destination document

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

jeyasri021291@gmail.com changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Priority|P2                          |P1
                 CC|                            |jeyasri021291@gmail.com

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