Solved

how to write coloum names in vertical format in pdf

Posted on 2011-02-23
3
619 Views
Last Modified: 2013-11-23
I am using pdf for printing.. I have many coloums hence the width of each coloum is less.
Therefore the coloum name doesnt fit properly in the coloum.
To avoid this I want to print it in vertical format. Can anyone suggest any solution for this??
0
Comment
Question by:Aurii
  • 2
3 Comments
 
LVL 17

Expert Comment

by:Dejan Pažin
ID: 34960240

Here is an example from the book:

http://itextpdf.com/examples/iia.php?id=202

0
 
LVL 17

Accepted Solution

by:
Dejan Pažin earned 250 total points
ID: 34960266

Forget the above example, this is what you need:

PdfPCell cell = new PdfPCell(new Phrase("Table Header 1"));
cell.setRotation(90);
0
 

Author Comment

by:Aurii
ID: 34960373
I refered the link ..how to implement it in my code

           Document document = new Document(PageSize.A4.rotate());
            PdfWriter.getInstance(document, new FileOutputStream("C:/Reports/Voucher"+i9+".pdf"));
            document.open();
           
           float[] width = {0.5f, 0.5f, 0.5f,1.0f,2.0f,2.5f,0.5f, 0.5f, 0.5f, 0.5f, 0.5f, 0.5f, 0.5f, 0.5f};
            PdfPTable table = new PdfPTable(width);
            table.setWidthPercentage(100);
          
          PdfPCell cell = new PdfPCell(new Phrase("UkEkquk ua 8  vkdkj.kh ;knhpk mrkjk", FontFactory.getFont("k30", BaseFont.CP1257, BaseFont.EMBEDDED, 26, Font.BOLD)));
           
            cell.setHorizontalAlignment(Element.ALIGN_CENTER);
            cell.setBorderWidth(0);
            cell.setColspan(14);
            cell.setUseDescender(true);
            table.addCell(cell);
0

Featured Post

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

Here is a helpful source code for C++ Builder programmers that allows you to manage and manipulate HTML content from C++ code, while also handling HTML events like onclick, onmouseover, ... Some objects defined and used in this source include: …
Go is an acronym of golang, is a programming language developed Google in 2007. Go is a new language that is mostly in the C family, with significant input from Pascal/Modula/Oberon family. Hence Go arisen as low-level language with fast compilation…
This theoretical tutorial explains exceptions, reasons for exceptions, different categories of exception and exception hierarchy.
This tutorial explains how to use the VisualVM tool for the Java platform application. This video goes into detail on the Threads, Sampler, and Profiler tabs.

744 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

13 Experts available now in Live!

Get 1:1 Help Now