Copy link to clipboard
Copied
Hello everyone!
I would like to set the Contents field of an InsertionPoint (or other object) from a database in a way that allows me to pass format information.
Sample text: "This is a text"
This is what I currently can do:
InsertionPoint ip;
ip.Contents = "This is a text";
Of course this means that I will lose all format information, so I have some pretty complicated code that splits the text in several sub-groups ("This", " is a " and "text") and sets the contents and styles for those. If at all possible, I would like to simplify this.
So, as mentioned in the first sentence, my question is: Is there any way to set the Contents field with format information?
I currently use Visual C# 2017 and InDesign CS6. An upgrade to CC is already scheduled. InDesign is accessed via Interop.InDesign.
Any help is highly appreciated!
Best regards,
Hans
Copy link to clipboard
Copied
Hi Hhans,
Other than applying a GREP style or a nested style through a paragraph style I see no way of doing this.
Both include rules or patterns how is what formatted using character styles.
Regards,
Uwe
Copy link to clipboard
Copied
Hi Uwe,
thanks a lot. I will look into both options. May be I can use one of them.
Best Regards,
Hans
Copy link to clipboard
Copied
Hi Hans,
hm… You said that InDesign CC is on its way to your machine 🙂
This means a huge gap in functionality between CS6 and CC 2018.
Unfortunately in regards of assigning contents nothing has changed in the DOM.
But:
The title of this thread says [VB/C#]. Check, if there are any problems with e.g. VB Script (if this relevant to you) and InDesign CC 2018. I think, I saw some reports on this here in the scripting forum. Could be wrong. Basically I'm on Mac OSX…
Regards,
Uwe
Copy link to clipboard
Copied
Hi Uwe,
Oh, I started developing my program back in the days of InDesign 2. And with every new version that my customer bought, I had to adapt quite a few things. I fully expect having to do the same with CC 2018. It's already on my PC btw., just not on the customer's yet.
Best Regards,
Hans
Copy link to clipboard
Copied
My couple of cents:
Check out xTags.
If your date base software is capable of generating the output using the xTags language, you'll be able to easily apply any formatting (e.g. bold, italic, super/subscript, par/char styles, etc.) to the text by script. Also, you'll be able to replace 'image' tags with images applying all the necessary formatting (e.g. width, height, scaling, skew, border, etc.).
— Kas
Copy link to clipboard
Copied
Hi Kas,
xTags might be a solution for my problem. I will look into it. Thanks for the heads up 🙂
Best Regards,
Hans
Get ready! An upgraded Adobe Community experience is coming in January.
Learn more