Archive
Posts Tagged ‘content-controls’
How to fix MS-Word not creating PDF Bookmarks for your Headings
2014/10/29
Leave a comment
- Problem: No navigation bar in Acrobat Reader when viewing your PDF created from MS-Word.
- Solution: Check this setting first in the Save as PDF Options:
-
But: Word 2013’s “Save as PDF” with “Create Bookmarks” may remains greyed out since it won’t even see your own heading styles, even if you based these styles on the built-in heading styles (which are known to contain “hidden magic” not easily replicated) , including their outline level, if
-
Heading appears in Content control.
-
Heading appears in Table.
-
-
Workaround:
-
Move headings out of Content Controls (you can still “lock”the text with Grouping, which will be enabled on the Developer Tab once you select at least a conten control and text (meant for form field labels).
-
Move headings outside of tables.
-
Categories: Glitches&Errors, office-software, service-is-documenting
2013, adobe-acrobat, bookmarks, content-controls, headings, MS-Word, outlining, pdf, tables
VBA script to more easily examine the properties of your Content Control-based forms
2014/10/09
Leave a comment
- The routine loops through the Content Controls and outputs properties as text into the VBA-Editor immediate window,
- from where it can be easily converted into an Excel-table which makes it easy t o spot and mark inconsistencies and outright oversights, like so:
Sub ccPropertiesPrint() On Error Resume Next Dim strHeadings, strProps As String Dim count As Integer Dim response strHeadings = strHeadings & "~" & "count" strHeadings = strHeadings & "~" & "Tag" strHeadings = strHeadings & "~" & "Title" strHeadings = strHeadings & "~" & "Type" strHeadings = strHeadings & "~" & "DefaultTextStyle" strHeadings = strHeadings & "~" & "Application" strHeadings = strHeadings & "~" & "BuildingBlockCategory" strHeadings = strHeadings & "~" & "BuildingBlockType" 'strHeadings = strHeadings & "~" & "Checked" 'strHeadings = strHeadings & "~" & "Creator" 'strHeadings = strHeadings & "~" & "DateCalendarType" 'strHeadings = strHeadings & "~" & "DateDisplayFormat" 'strHeadings = strHeadings & "~" & "DateDisplayLocale" 'strHeadings = strHeadings & "~" & "DateStorageFormat" 'strHeadings = strHeadings & "~" & "DropdownListEntries" strHeadings = strHeadings & "~" & "ID" strHeadings = strHeadings & "~" & "LockContentControl" strHeadings = strHeadings & "~" & "LockContents" strHeadings = strHeadings & "~" & "MultiLine" 'strHeadings = strHeadings & "~" & "Parent" strHeadings = strHeadings & "~" & "ParentContentControl" strHeadings = strHeadings & "~" & "PlaceholderText" strHeadings = strHeadings & "~" & "Range" strHeadings = strHeadings & "~" & "ShowingPlaceholderText" strHeadings = strHeadings & "~" & "Temporary" 'strHeadings = strHeadings & "~" & "XMLMapping" Debug.Print strHeadings If ActiveDocument.ContentControls.count > 0 Then For Each oCC In ActiveDocument.ContentControls 'debug 'If oCC.Type = 9 Then 'debug: repeating count = count + 1 If count = 50 Then 'dim response = vbmsgboxresponse Exit For End If ' useless cannot access immediate window If count = 15 Then response = MsgBox("paused", vbOKOnly) End If strProps = "" 'start over strProps = strProps & "~" strProps = strProps & count 'CStr(count) strProps = strProps & "~" strProps = strProps & CStr(Replace(Replace(oCC.Tag, Chr(13), "#"), Chr(10), "#")) strProps = strProps & "~" strProps = strProps & CStr(Replace(Replace(oCC.Title, Chr(13), "#"), Chr(10), "#")) strProps = strProps & "~" strProps = strProps & CStr(Replace(Replace(oCC.Type, Chr(13), "#"), Chr(10), "#")) strProps = strProps & "~" strProps = strProps & CStr(Replace(Replace(oCC.DefaultTextStyle, Chr(13), "#"), Chr(10), "#")) strProps = strProps & "~" strProps = strProps & CStr(Replace(Replace(oCC.Application, Chr(13), "#"), Chr(10), "#")) strProps = strProps & "~" strProps = strProps & CStr(Replace(Replace(oCC.BuildingBlockCategory, Chr(13), "#"), Chr(10), "#")) strProps = strProps & "~" strProps = strProps & CStr(Replace(Replace(oCC.BuildingBlockType, Chr(13), "#"), Chr(10), "#")) 'strProps = strProps & "~" 'strProps = strProps & CStr(Replace(Replace(oCC.Checked, Chr(13), "#"), Chr(10), "#")) 'strProps = strProps & "~" 'strProps = strProps & CStr(Replace(Replace(oCC.Creator, Chr(13), "#"), Chr(10), "#")) 'strProps = strProps & "~" 'strProps = strProps & CStr(Replace(Replace(oCC.DateCalendarType, Chr(13), "#"), Chr(10), "#")) 'strProps = strProps & "~" 'strProps = strProps & CStr(Replace(Replace(oCC.DateDisplayFormat, Chr(13), "#"), Chr(10), "#")) 'strProps = strProps & "~" 'strProps = strProps & CStr(Replace(Replace(oCC.DateDisplayLocale, Chr(13), "#"), Chr(10), "#")) 'strProps = strProps & "~" 'strProps = strProps & CStr(Replace(Replace(oCC.DateStorageFormat, Chr(13), "#"), Chr(10), "#")) 'strProps = strProps & "~" 'strProps = strProps & CStr(Replace(Replace(oCC.DropdownListEntries.count, Chr(13), "#"), Chr(10), "#")) strProps = strProps & "~" strProps = strProps & CStr(Replace(Replace(oCC.ID, Chr(13), "#"), Chr(10), "#")) strProps = strProps & "~" strProps = strProps & CStr(Replace(Replace(oCC.LockContentControl, Chr(13), "#"), Chr(10), "#")) strProps = strProps & "~" strProps = strProps & CStr(Replace(Replace(oCC.LockContents, Chr(13), "#"), Chr(10), "#")) strProps = strProps & "~" strProps = strProps & CStr(Replace(Replace(oCC.MultiLine, Chr(13), "#"), Chr(10), "#")) 'strProps = strProps & "~" 'strProps = strProps & CStr(Replace(Replace(oCC.Parent, Chr(13), "#"), Chr(10), "#")) strProps = strProps & "~" strProps = strProps & CStr(Replace(Replace(oCC.ParentContentControl, Chr(13), "#"), Chr(10), "#")) strProps = strProps & "~" strProps = strProps & CStr(Replace(Replace(oCC.PlaceholderText, Chr(13), "#"), Chr(10), "#")) strProps = strProps & "~" strProps = strProps & CStr(Replace(Replace(oCC.Range, Chr(13), "#"), Chr(10), "#")) strProps = strProps & "~" strProps = strProps & CStr(Replace(Replace(oCC.ShowingPlaceholderText, Chr(13), "#"), Chr(10), "#")) strProps = strProps & "~" strProps = strProps & CStr(Replace(Replace(oCC.Temporary, Chr(13), "#"), Chr(10), "#")) 'strProps = strProps & "~" 'strProps = strProps & CStr(Replace(Replace(oCC.XMLMapping, Chr(13), "#"), Chr(10), "#")) Debug.Print vbCrLf & strProps & vbCrLf 'End If 'oCC.Type=9 then 'debug: repeating Next End If End Sub
Expanding the Review and Modify Content Control Properties to include Repeating Sections
2014/10/08
Leave a comment
- Greg Maxey provides a lot of useful information on MS-Word content Controls, including a VBA utility to more easily loop through the properties and placeholder text dialogue of Content Controls when building your MS-Word forms.
- Unfortunately, the latter bit fails with nested repeating (wdContentControlRepeatingSection):
- The debugger shows that it Errors on non placeholder text of repeating controls set to
- “.txtPHText = oCC.PlaceholderText” which it breaks into, and a watch put on oCC shows:
- The form 1 (display of inbuilt form ) works and is useful also for wdContentControlRepeatingSection, while form 2 has no use for wdContentControlRepeatingSection. So as a workaround, we just do not show form 2 if placeholder text isNothing:
- We have no pretension to redistribute, get the utility from Greg’s website, it is open and you can extend it with above, if you need to.
Sub CCPropertiesReviewModify() Dim oFrm As frmCC bCancel = False If ActiveDocument.ContentControls.Count > 0 Then For Each oCC In ActiveDocument.ContentControls oCC.Range.Select Dialogs(wdDialogContentControlProperties).Show Set oFrm = New frmCC If Not isNothing(oCC.PlaceholderText) Then 'trp With oFrm .Caption = oCC.Title .txtPHText = oCC.PlaceholderText .Show End With End If If bCancel Then Exit For Next oCC Unload oFrm Set oFrm = Nothing Else MsgBox "This document does not contain any Content Controls.", vbInformation, "Review\Set Content Control Properties" End If lbl_Exit: Exit Sub End Sub
Now what about wdContentControlGroup?