Search...
FAQs
Subscribe
Pie
FAQs
Recent topics
Flagged topics
Hot topics
Best topics
Search...
Search within Open Source Projects
Search Coderanch
Advance search
Google search
Register / Login
Win a copy of
Communication Patterns: A Guide for Developers and Architects
this week in the
Design and Architecture
forum!
Post Reply
Bookmark Topic
Watch Topic
New Topic
programming forums
Java
Mobile
Certification
Databases
Caching
Books
Engineering
Micro Controllers
OS
Languages
Paradigms
IDEs
Build Tools
Frameworks
Application Servers
Open Source
This Site
Careers
Other
Pie Elite
all forums
this forum made possible by our volunteer staff, including ...
Marshals:
Campbell Ritchie
Ron McLeod
Paul Clapham
Devaka Cooray
Liutauras Vilda
Sheriffs:
Jeanne Boyarsky
paul wheaton
Henry Wong
Saloon Keepers:
Stephan van Hulst
Tim Holloway
Tim Moores
Carey Brown
Mikalai Zaikin
Bartenders:
Lou Hamers
Piet Souris
Frits Walraven
Forum:
Other Open Source Projects
how to insert rectangle with color in table using itext API
Komari raj
Ranch Hand
Posts: 43
posted 13 years ago
Number of slices to send:
Optional 'thank-you' note:
Send
Hi all,
I want to insert rectangle with filled color into table cell into
Word
document using itext API.
i am able to see text only in document...but i am not able to see rectangle in word document with the following code.
public void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { Document document = new Document(); try{ response.setContentType("application/msword"); RtfWriter2 writer =RtfWriter2.getInstance(document, response.getOutputStream()); document.open(); BufferedImage bimg =new BufferedImage(170, 170, BufferedImage.TYPE_INT_RGB); Graphics graphics = bimg.getGraphics(); graphics.setColor(Color.BLUE); graphics.fillRect(0, 0, 170, 170); graphics.setColor(Color.GREEN); graphics.fillOval(100, 100, 90, 90); graphics.setColor(Color.BLACK); graphics.drawRect(0, 0, 169, 169); com.lowagie.text.Image image = com.lowagie.text.Image.getInstance(bimg, null); Phrase phs=new Phrase(new Chunk(image, 0, 0, true)); com.lowagie.text.Table table = new com.lowagie.text.Table(2); com.lowagie.text.Cell cell = new com.lowagie.text.Cell(); cell.add(phs); com.lowagie.text.Cell cel2 = new com.lowagie.text.Cell("HelloTablecell2"); table.addCell(cell); table.addCell(cel2); document.add(table); }catch(Exception e){ e.printStackTrace(); } document.close(); response.getOutputStream().flush(); }
Please help on this...
Thanks in advance
Regards
Raju
Please enjoy this holographic presentation of our apocalyptic dilemma right after this tiny ad:
We need your help - Coderanch server fundraiser
https://coderanch.com/wiki/782867/Coderanch-server-fundraiser
reply
reply
Bookmark Topic
Watch Topic
New Topic
Boost this thread!
Similar Threads
web dynpro application
need help with this code
Vertical Spacing Issue After iText Upgrade
web dynpro application coding
Image not dispaying in RTF document (Worddocument) using iText API
More...