What were you expecting the no wrap to do? Best Regards, Paulo Soares
> -----Original Message----- > From: [EMAIL PROTECTED] > [mailto:[EMAIL PROTECTED] On > Behalf Of Zeno Lee > Sent: Thursday, July 29, 2004 2:42 PM > To: [EMAIL PROTECTED] > Subject: [iText-questions] PdfPCell.NoWrap Property problem > in ItextSharp (PdfPCell.setNoWrap in Java) > > I'm using iTextSharp and I'm trying to use PdfPCell cells > that do not wrap. > In my PdfPTable, I'm trying to prevent the cells in the first > column from > wrapping. I've tried using setNoWrap but there are 2 issues. > In Java, > PdfPCell.setNoWrap(true) works, but the Phrase inside the > cell overwrites > the adjacent cell. In C#, PdfPCell.NoWrap = true has no effect. > > I've modified PdfPRows.cs as well as PDfPTable.cs to correspond to the > latest Java iText version. The C# version had different > PdfPRows.writeCells > and PDfPTable.writeSelectedRows methods. This does not work. > > Is there a different way of preventing the PdfPCell contents > from wrapping? > Is it possible to prevent just the first column from wrapping > even if there > are other columns in the same row that wrap? > > I've attached the PDF outputs of both C# and Java. > > // C# Version > using System; > using System.IO; > using System.Collections; > using System.Diagnostics; > using System.Threading; > > using iTextSharp; > using iTextSharp.text; > using iTextSharp.text.pdf; > > public class MyClass > { > public static void Main() > { > String f = "C:\\TEMP\\_nowrap.cs.pdf"; > Document d = new Document(PageSize.LETTER); > PdfWriter w = PdfWriter.getInstance(d, new FileStream(f, > FileMode.Create)); > > d.Open(); > PdfPTable t = new PdfPTable(10); > for (int i = 0; i < 20; i++) > { > PdfPCell c; > c = new PdfPCell(new Phrase(new > Chunk("Chunk Wrap" + > i))); > if (i % 10 == 0) > { > c.NoWrap = true; > } > t.addCell(c); > } > d.Add(t); > d.Close(); > > > Process p = new Process(); > try { > p.StartInfo.FileName = f; > p.StartInfo.CreateNoWindow = true; > p.Start(); > } catch (Exception e) { > Console.WriteLine(e.Message); > } > } > } > > // Java version > import java.io.FileOutputStream; > > import com.lowagie.text.Chunk; > import com.lowagie.text.Document; > import com.lowagie.text.PageSize; > import com.lowagie.text.Phrase; > import com.lowagie.text.pdf.PdfPCell; > import com.lowagie.text.pdf.PdfPTable; > import com.lowagie.text.pdf.PdfWriter; > > public class Test { > public static void main(String[] args) { > String f = "C:/temp/_nowrap.java.pdf"; > Document d = new Document(PageSize.LETTER); > try { > PdfWriter w = PdfWriter.getInstance(d, new > FileOutputStream(f)); > } catch (Exception e) { > // TODO: handle exception > } > > d.open(); > PdfPTable t = new PdfPTable(10); > for (int i = 0; i < 20; i++) { > PdfPCell c; > c = new PdfPCell(new Phrase(new > Chunk("Chunk Wrap" + > i))); > if (i % 10 == 0) { > c.setNoWrap(true); > } > t.addCell(c); > } > try { > d.add(t); > } catch (Exception e) { > // TODO: handle exception > } > d.close(); > } > } > > > ------------------------------------------------------- This SF.Net email is sponsored by BEA Weblogic Workshop FREE Java Enterprise J2EE developer tools! Get your free copy of BEA WebLogic Workshop 8.1 today. http://ads.osdn.com/?ad_idG21&alloc_id040&op=click _______________________________________________ iText-questions mailing list [EMAIL PROTECTED] https://lists.sourceforge.net/lists/listinfo/itext-questions
