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

          Priority: P2
            Bug ID: 53308
          Assignee: [email protected]
           Summary: How to produce content with alignment from source
                    document to destination document
          Severity: major
    Classification: Unclassified
                OS: Windows XP
          Reporter: [email protected]
          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: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to