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/02/02 21:15:54 UTC
DO NOT REPLY [Bug 52588] New: replaceText fail for tables
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: josecarloslacerda@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-unsubscribe@poi.apache.org
For additional commands, e-mail: dev-help@poi.apache.org
DO NOT REPLY [Bug 52588] replaceText fail for tables
Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=52588
Yegor Kozlov <ye...@dinom.ru> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|NEW |RESOLVED
Resolution| |INVALID
OS/Version| |All
Severity|critical |normal
--- Comment #1 from Yegor Kozlov <ye...@dinom.ru> 2012-02-07 10:09:51 UTC ---
I'm testing with the latest build from trunk and Excel 2007 and Excel 2010 are
happy to open the generated file.
Please try with the latest build from trunk,
daily builds can be downloaded form here:
http://encore.torchbox.com/poi-cvs-build/
Yegor
--
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-unsubscribe@poi.apache.org
For additional commands, e-mail: dev-help@poi.apache.org
DO NOT REPLY [Bug 52588] replaceText fail for tables
Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=52588
--- Comment #2 from José Carlos Lacerda <jo...@msn.com> 2012-02-07 18:59:19 UTC ---
(In reply to comment #1)
> I'm testing with the latest build from trunk and Excel 2007 and Excel 2010 are
> happy to open the generated file.
>
> Please try with the latest build from trunk,
> daily builds can be downloaded form here:
> http://encore.torchbox.com/poi-cvs-build/
>
> Yegor
My problem is with file Word 2003.
i'm trying open that link but it's broken
--
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-unsubscribe@poi.apache.org
For additional commands, e-mail: dev-help@poi.apache.org
[Bug 52588] replaceText fail for tables
Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=52588
gbogaert62@gmail.com changed:
What |Removed |Added
----------------------------------------------------------------------------
Priority|P2 |P5
CC| |gbogaert62@gmail.com
Severity|normal |critical
--- Comment #3 from gbogaert62@gmail.com ---
I have the same problem.
The output file is corrupt. MS Word can fix it but you have to save it and to
"open and fix" with Word.
the code is the same :
HWPFDocument document = new HWPFDocument(blobWord.getBinaryStream());
document.getRange().replaceText("${******}", "*******");
--
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