I don't think your code below will ever work.

Line 1.. Missing a closing ) at the end of the line to close GetInstance
Line 3 uses lobjDocument2.Open();
and on line 3 and 4 you are adding content to lobjDocument and closing lobjDocument.

You never opened lobjDocument you opened lobjDocument2!

Howard Shank

----- Original Message ----
From: Amanda Nerissa D'souza <[EMAIL PROTECTED]>
To: "[email protected]" <[email protected]>
Sent: Tuesday, April 22, 2008 11:16:07 PM
Subject: Re: [iText-questions] RTF and iTextSharp

Hi,

I am using Itextsharp to create a RTF document in .NET. I find that using Rtfwriter, the properties like KeepTogether, TableFitsPage, CellsFitPage do not work. They do work using Rtfwriter2. But Rtfwriter2 seems to have a problem with Document.Close() function. It gives me the following error.

 

RtfWriter2 writer2 = RtfWriter2.GetInstance(lobjDocument,new FileStream("ABC.rtf",FileMode.Create);

parTitle = new Paragraph(“This is a new document”, FontFactory.GetFont(FontFactory.HELVETICA, 16, iTextSharp.text.Font.BOLD));

lobjDocument2.Open();

lobjDocument.Add(parTitle);

lobjDocument.Close(); --- Run time error : Cannot access a closed file.

 

Is there a solution or workaround for this?

 

Thanks & Regards,

Amanda D'Souza

Manufacturing (MFGD)

 

Please think of the environment before printing this email. 

 

**************** CAUTION - Disclaimer *****************
This e-mail contains PRIVILEGED AND CONFIDENTIAL INFORMATION intended solely for the use of the addressee(s). If you are not the intended recipient, please notify the sender by e-mail and delete the original message. Further, you are not to copy, disclose, or distribute this e-mail or its contents to any other person and any such actions are unlawful. This e-mail may contain viruses. Infosys has taken every reasonable precaution to minimize this risk, but is not liable for any damage you may sustain as a result of any virus in this e-mail.. You should carry out your own virus checks before opening the e-mail or attachment. Infosys reserves the right to monitor and review the content of all messages sent to or from this e-mail address. Messages sent to or from this e-mail address may be stored on the Infosys e-mail system.
***INFOSYS******** End of Disclaimer ********INFOSYS***


Be a better friend, newshound, and know-it-all with Yahoo! Mobile. Try it now.
-------------------------------------------------------------------------
This SF.net email is sponsored by the 2008 JavaOne(SM) Conference 
Don't miss this year's exciting event. There's still time to save $100. 
Use priority code J8TL2D2. 
http://ad.doubleclick.net/clk;198757673;13503038;p?http://java.sun.com/javaone
_______________________________________________
iText-questions mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/itext-questions

Do you like iText?
Buy the iText book: http://www.1t3xt.com/docs/book.php
Or leave a tip: https://tipit.to/itexttipjar

Reply via email to