These forums are now Read Only. If you have an Acrobat question, ask questions and get help from one of our experts.

Adding Text to Textframe with C#.NET

bhaskar_joardar
Registered: Dec 17 2007
Posts: 2

Hi, I am developing an indd file programatically with C#.NET. I am importing an XML successfully and want to design the indd file with the value of the XML. The problem is that I am not being able to write the values to the textframe. I have the indesign CS3 trial version installed in my computer. Here is the code below.
Type indAppType = Type.GetTypeFromProgID("InDesign.Application");
InDesign.Application myInDesign = (InDesign.Application)Activator.CreateInstance(indAppType, true);
InDesign.Document myDocument = myInDesign.Documents.Add(true, myInDesign.DocumentPresets[1]);
 
InDesign.Page myPage = (InDesign.Page) myDocument.Pages[1];
myDocument.ImportXML(Server.MapPath("Indesing-doc/bhaskar.xml"));
InDesign.Rectangle myRectangleA = myPage.Rectangles.Add(myDocument.Layers[1], InDesign.idLocationOptions.idUnknown, myPage);
myRectangleA.GeometricBounds = new string [4] {"70pt", "70pt", "180pt", "500pt"};
InDesign.TextFrame textFrameA = myRectangleA.TextFrames.Add(myDocument.Layers[1], InDesign.idLocationOptions.idUnknown, myRectangleA);
textFrameA.GeometricBounds = new string[4] { "80pt", "80pt", "140pt", "450pt" };
 
/*
Here I want to add my text in the textFrameA and want to fill the myRectangleA with the Orange colour. Please help me. Or if you can show me the way to associate the textFrameA or myRectangleA with the element of the XML, that will also be helpful.
*/
 
myDocument.Close(idSaveOptions.idNo, Server.MapPath("testing"));

My Product Information:
LiveCycle Designer, Windows
thomp
Expert
Registered: Feb 15 2006
Posts: 4411
I hate to tell you this Bhaskar, but this forum is only for Acrobat JavaScript questions. There are many fine InDesign forums, try:

[url=http://www.adobeforums.com/]http://www.adobeforums.com/[/url]

Thom Parker
The source for PDF Scripting Info
www.pdfscripting.com
Very Important - How to Debug Your Script