Getting the 'content' from a Rich Text Content Control - vba

I need to get the 'contents' of a Rich Text Content Control in Word, and paste that content into another Rich Text Content Control (formatted).
Here's the code I have:
ActiveDocument.SelectContentControlsByTitle("original").Item(1).Range.FormattedText.Copy
ActiveDocument.SelectContentControlsByTitle("duplicate").Item(1).Range.Paste
Which seems to work, but it's copying the entire original ContentControl into (nested) the duplicate ContentControl... and I just want the formatted text alone.
original and duplicate content which is nested

Try:
With ActiveDocument
.SelectContentControlsByTitle("duplicate")(1).Range.FormattedText = _
.SelectContentControlsByTitle("original")(1).Range.FormattedText
End With

Rather than use vba for this, Map the Content Controls.
For Rich Text controls, you will need to map the XML parts.
Data Mapping
The real power of content controls lies in their ability to be mapped
(or bound) to a custom XML data store embedded in the Word 2007/2010
OfficeOpenXML format document file. Through this binding:
Any changes in the data store data is automatically repeated in all content controls mapped to that data.
Any changes to a mapped content control automatically updates the data store and all other content controls mapped to that data store
data.
Word Content Controls by Greg Maxey
While you can do this yourself, why? There are a number of free tools that will do it for you.
Mayor & Maxey CC/V/B & DV Tools Add-In
Content Control Tools by Greg Maxey
Insert Content Controls Add-In by Graham Mayor
Custom Content Control Dialog Add-In by Greg Maxey
I am sure there are more out there but I have used the above tools. They have different interfaces and powers but all of them give you the ability to add a Mapped Content Control to a document, including a Rich Text one.

Related

Is there an possibility to save a dynamic pdf as static but still have interactive fields within the document?

I have a dynamic pdf which I want to use for DocuSign and thus needs to be static. I cannot simply make use of the print as pdf function as I still want to use the interactive fields within the pdf.
I Tried to use Adobe AEM Forms Designer to save the document as static. But solely the first page of the form is saved.
Regarding your concern, I would like to share the following information, you can learn about PDF form field transformation. It enables you to transform PDF form fields automatically into DocuSign tabs, carrying over all of their existing values. The locations of the created tabs will match the locations of the fields from which they were generated.
To transform PDF form fields into DocuSign tabs, you need to set the transformPdfFields property on the documents whose fields you want to transform.
https://developers.docusign.com/docs/esign-rest-api/esign101/concepts/tabs/pdf-transform/
https://www.docusign.com/blog/developers/the-trenches-pdf-form-field-transformation
Best Regards,
Eric | DocuSign

#DBLookup and image display on web

I am having issues with displaying an image in a Rich Text field on Notes document on the web. On web form, I have a form with a computed Rich Text field with this logic for the value:
#DbLookup("":"NoCache";"":#DbName;"notices";"americas-en-LoginMsg";"Error_Body";[FailSilent])
The source document is different than the destination document.
When The Web form opens up, only the formatted text displays and the image is just a placeholder with no image displaying. Any ideas on how to get it displayed. Using Domino server vers. 9.0.1.
I placed the image(s) in Resources>Images area of the database and used pass thru HTML on source document to reference it (them): img src="https://something.com/webpages/database.nsf/Buyback.gif?OpenImageResource" (with proper formatting of course).

Content control toolkit creates extra custom xml parts on reopen docx

I am creating a docx with 2 rich text controls and 1 picture control. I open content control toolkit, create 1 custom xml part, type in the xml and bind xml tags to the content controls. I save the mapping and close it. When I reopen the docx, I see 3 custom xml parts created. All 3 with all the content controls. I am surprised why it would do that. As a result, when I apply the bindings using docx4j API, the data gets updated in the last custom xml part. Guess the output docx only shows the first custom xml part and hence I dont see any bound values. When I unzipped the docx and looked at the contents, I see that the last cutom xml part has been updated with the values, I set using the docx4j code. Am I doing anything different that makes content control toolkit create the extra custom xml parts? Please let me know.
If you look at the w:dataBinding elements, do they each have the same #w:storeItemID values?
Given your description, you'd expect a different value for each content control. If that's the case, docx4j should respect that. That is, it ought to use whatever is in the three custom XML parts. (The standard code for first injecting the XML will only inject it into one part though)
As a general comment, most docx4j users (me included) would use an OpenDoPE AddIn, not the content control toolkit, so I can't comment on its behaviour.

Modify character spacing in a PDF form field

I'm trying to build a web app to programmatically fill out a PDF form. I am going to configure my form first in Adobe Acrobat, then write a Java app with iText to fill out all the form fields via user input from the web. The base form I need to fill out comes from the US government. They created form fields with extremely large kerning (character spacing) values I need to change. However, there appears to be no way to modify this value in the Acrobat UI.
Does anyone know how to manipulate character spacing on form fields in Acrobat 8.0 for Windows? I could try to use iText to programmatically manipulate the kerning of the original document, but this would be much more tedious.
I believe I figured this out: kerning is called "combing" in acrobat, and each of the form fields have been "combed". The strange thing is this option isn't checked when I view the properties of the form field, but "combing" is the behaviour I was attempting to replicate.

Transferring Rich Text data from Access to Word

I've been saddled with supporting an old Access 2003 database (with SQL backend) produced by a now out-of-business contractor.
The database includes several 'unconventional' reports. They all use Automation through VBA to output fields directly to a Word document. Kind of like this (pseudo code):
for each row{
output(row.id);
moveRight();
output(row.firstName);
newLine();
}
Etc.
The problem is, the database includes several rich text fields. To output these (including their formatting) to the document, the developer opens a separate Access form, with a single rich text control, and pulls the appropriate field into the text box.
He then does a 'select all, copy', flicks back to Word, and then pastes the text.
My task is to add a new rich text field to a report, and I feel there must be a better way of doing this...
Ah! A duplicate question apparently.
Here's the answer:
Word Automation: Write RTF text without going through clipboard