  | Mailing List | | Home | | Forum Home | | JBoss - Java Application Server | | Tomcat - JSP/Servlet container | | Struts - A MVC web framework | | iText - An open source PDF Java Library | | JDOM - JDOM XML Parser | | JSP - A mailing list about Java Server Pages specification and reference | | J2EE - A mailing list for Java(tm) 2 Platform, Enterprise Edition | | J2EE Pattern - An interest list for Sun Java Center J2EE Pattern Catalog | | Servlet - A mailing list for discussion about Sun Microsystem's Java Servlet API Technology | |
Struts & Hibernate
|
|
|
  | | | RTF-Color import mappings for table elements | RTF-Color import mappings for table elements 2007-11-06 - By Howard Shank
Back During the import process of a RTF file, the following keywords are not mapped to the new color table entries. The result of them not being mapped causes the background colors for tables to be incorrect.
Keyword: \clcbpat \clcbpatraw.
Below are my changes that map the colors. I added "else if" statements to handle the 2 control words.
Class: RtfParser Method: HandleCtrlWord -- ---- ---- ---- ---code start-- ---- ---- ---- ------
public void HandleCtrlWord(String ctrlWord, int groupLevel) { if (this.state == PARSER_IN_DOCUMENT) { if (RtfColorTableParser.StringMatches(ctrlWord, "\\f")) { ctrlWord = "\\f" + this.importHeader.MapFontNr(ctrlWord .Substring(2)); } else if (RtfColorTableParser.StringMatches(ctrlWord, "\\cf")) { ctrlWord = "\\cf" + this.importHeader.MapColorNr(ctrlWord .Substring(3)); } else if (RtfColorTableParser.StringMatches(ctrlWord, "\\cb")) { ctrlWord = "\\cb" + this.importHeader.MapColorNr(ctrlWord .Substring(3)); } else if (RtfColorTableParser.StringMatches(ctrlWord, "\\clcbpat ")) { ctrlWord = "\\clcbpat" + this.importHeader.MapColorNr (ctrlWord.Substring(8)); } else if (RtfColorTableParser.StringMatches(ctrlWord, "\ \clcbpatraw")) { ctrlWord = "\\clcbpatraw" + this.importHeader.MapColorNr (ctrlWord.Substring(11)); } this.rtfDoc.Add(new RtfDirectContent(ctrlWord)); } else if (this.state == PARSER_IN_FONT_TABLE) { this.fontTableParser.HandleCtrlWord(ctrlWord, groupLevel); } else if (this.state == PARSER_IN_COLOR_TABLE) { this.colorTableParser.HandleCtrlWord(ctrlWord, groupLevel); } else if (this.state == PARSER_IN_HEADER) { if (ctrlWord.Equals("\\info")) { this.state = PARSER_IN_INFO_GROUP; } else if (ctrlWord.Equals("\\fonttbl")) { this.state = PARSER_IN_FONT_TABLE; } else if (ctrlWord.Equals("\\colortbl")) { this.state = PARSER_IN_COLOR_TABLE; } } } -- ---- ---- ---- ---- -----code end-- ---- ---- ---- ---- ---- ---- ---- Regards
__ ____ ____ ____ ____ ____ ____ ____ ____ ____ __ Do You Yahoo!? Tired of spam? Yahoo! Mail has the best spam protection around http://mail.yahoo.com
-- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ----- This SF.net email is sponsored by: Splunk Inc. Still grepping through log files to find problems? Stop. Now Search log events and configuration files using AJAX and a browser. Download your FREE copy of Splunk now >> http://get.splunk.com/ __ ____ ____ ____ ____ ____ ____ ____ ____ ____ iText-questions mailing list iText-questions@(protected) https://lists.sourceforge.net/lists/listinfo/itext-questions Buy the iText book: http://itext.ugent.be/itext-in-action/
|
|
 |