poi-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "史虎杰"<shihu...@gbicc.net>
Subject Re: Re: Implement cell forumula border feature
Date Tue, 20 Jul 2010 09:16:04 GMT
i have tried the example you give,But appear the same error ,when i create the word 2007 by
using the POI 3.7 version .
this is the error picture :  

p.s: the picture say that ,can not open the Offie Open XML file of simple.docx,because the
content have mistakes.
          text/xml Statement can only appear in the beginning of the input.
         position: part: /word/footer1.xml,row:2,column:310

I use the following code modify with the code that you gived:

 try {
   // Open a document
   XWPFDocument sampleDoc = new XWPFDocument(new FileInputStream(
     new File("E:\\SampleDoc.docx")));
   // Obtain the XWPFHeaderFooterPolicy object
   XWPFHeaderFooterPolicy policy = sampleDoc.getHeaderFooterPolicy();
   // Next create the Paragraphs that are to be added into the header or
   // footer. It is possible to add more that one run - the CTR object
   // to each Paragraph.
   CTP ctP1 = CTP.Factory.newInstance();
   CTR ctR1 = ctP1.addNewR();
   CTText t = ctR1.addNewT();
   t.setStringValue("First Paragraph in footer.");
   // Create the second paragraph
   CTP ctP2 = CTP.Factory.newInstance();
   CTR ctR2 = ctP2.addNewR();
   CTText t2 = ctR2.addNewT();
   t2.setStringValue("Second paragraph for the footer");
   // And the third.
   CTP ctP3 = CTP.Factory.newInstance();
   CTR ctR3 = ctP3.addNewR();
   CTText t3 = ctR3.addNewT();
   t3.setStringValue("Third paragraph for the footer");
   XWPFParagraph p1 = new XWPFParagraph(ctP1);
   XWPFParagraph p2 = new XWPFParagraph(ctP2);
   XWPFParagraph p3 = new XWPFParagraph(ctP3);
   XWPFParagraph[] pars = new XWPFParagraph[3];
   pars[0] = p1;
   pars[1] = p2;
   pars[2] = p3;
   // Now, create the default footer for the document and add the
   // Paragraphs just created to it.
   XWPFFooter footer = policy.createFooter(policy.DEFAULT, pars);
   //write doc to the fileoutputstream
   FileOutputStream out = new FileOutputStream("e:\\simple.docx");
  } catch (Exception e) {

----- Original Message ----- 
From: Nick Burch 
To: POI Users List 
Sent: 2010-07-19, 19:18:38
Subject: Re: Implement cell forumula border feature

On Sun, 18 Jul 2010, allelopath wrote:
> Excel has a feature in which when you dbl-clk on a cell with a formula, 
> the cells referred to by that formula become correspondingly colored.
> I need to implement this in Java with POI.

The formula parser is where you'll want to be looking. You probably want 
to look at the reference based Ptgs in the formula (generating the ptgs 
from the text for xssf), then ask the reference ptgs nicely for the cells 
they reference


To unsubscribe, e-mail: user-unsubscribe@poi.apache.org
For additional commands, e-mail: user-help@poi.apache.org
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message