Solved

how to write coloum names in vertical format in pdf

Posted on 2011-02-23
3
623 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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

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…
Introduction This article is the last of three articles that explain why and how the Experts Exchange QA Team does test automation for our web site. This article covers our test design approach and then goes through a simple test case example, how …
Viewers will learn about the different types of variables in Java and how to declare them. Decide the type of variable desired: Put the keyword corresponding to the type of variable in front of the variable name: Use the equal sign to assign a v…
THe viewer will learn how to use NetBeans IDE 8.0 for Windows to perform CRUD operations on a MySql database.

920 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

16 Experts available now in Live!

Get 1:1 Help Now