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

             Bug #: 52588
           Summary: replaceText fail for tables
           Product: POI
           Version: 3.8-dev
          Platform: PC
            Status: NEW
          Severity: critical
          Priority: P2
         Component: HWPF
        AssignedTo: dev@poi.apache.org
        ReportedBy: josecarloslace...@msn.com
    Classification: Unclassified


Created attachment 28255
  --> https://issues.apache.org/bugzilla/attachment.cgi?id=28255
model file with tables

I have problems for to use the method Range.replaceText() for alter values into
tables. When i try to alter values into tables, the file created is corrupted.

i'm using the poi-bin-3.8-beta5-20111217 version.


A simple exemple:

import java.io.File;
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.IOException;
import java.text.Normalizer;

import org.apache.poi.hwpf.HWPFDocument;
import org.apache.poi.hwpf.usermodel.Paragraph;
import org.apache.poi.hwpf.usermodel.Range;
import org.apache.poi.hwpf.usermodel.Table;
import org.apache.poi.hwpf.usermodel.TableCell;
import org.apache.poi.hwpf.usermodel.TableRow;
import org.apache.poi.poifs.filesystem.POIFSFileSystem;


public class Tests {

    /**
     * @param args
     */
    public static void main(String[] args) {

        try {

            File arquivo = new File("C:\\in.doc");
            FileInputStream input = new FileInputStream(arquivo);
            POIFSFileSystem poi = new POIFSFileSystem(input);

            HWPFDocument doc = new HWPFDocument(poi);

            Range rg = doc.getRange();

            rg.replaceText("${name}", "José Carlos");

            FileOutputStream out = new FileOutputStream(new
File("C:\\out.doc"));

            doc.write(out);
            out.flush();
            out.close();
            input.close();

        } catch (Exception e){

        }

    }
}

-- 
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscr...@poi.apache.org
For additional commands, e-mail: dev-h...@poi.apache.org

Reply via email to