I would like to write a VBA macro that highlights all paragraphs that have any kind of formatting applied, causing those paragraphs to not match their style.
Then I want to highlight in a different color all text with altered font applied. This would allow me to see all the horrible mangling someone else did to a document, since many Word users ignore styles. I can probably muddle through most of the VBA required, but I have not found a snippet for specifically selecting directly formatted objects.
What have you tried?
Pressing Ctrl+A, Ctrl+Q, Ctrl+Spacebar will return all text to the paragraph and font settings prescribed by the corresponding Styles. If you then save that document with a new filename and use Word's document comparison tools, that will show you all the formatting differences between the two.
Do note, though, that the process removes formatting applies by character Styles, too.
Simple as - and no code required. That said, see also:
https://answers.microsoft.com/en-us/msoffice/forum/all/print-applied-document-formatting-not-real-styles/e291f11e-7e07-47d8-be7f-22677cdb4ac0
Related
Is there a way to detect if there is formatting or not (i.e. Rich) anywhere in a RichTextBox?
I'd like to write RichTextBox.Rtf is there is, and RichTextBox.Text if there isn't.
I came across a post that suggested checking the SelectionFont after selecting all text, but I have no idea how to accomplish that, or if it would work.
Thanks!
You can check the rtf property of the richtextbox: richtextbox1.rtfto see the rich text code. Even with no additional formatting, there will be some rich text formatting. For example, here's what you get with a richtextbox containing only "text":
{\rtf1\ansi\ansicpg1252\deff0\deflang1033{\fonttbl{\f0\fnil\fcharset0 Microsoft Sans Serif;}}
\viewkind4\uc1\pard\f0\fs16 test\par
}
You can check to see if there are any additional formatting tags, and if not, it should be plain text. You can also access the plain text (without formatting) with richtextbox1.text.
I have a PDF document, and I want to mask certain text blocks. The reason why I want to do this, is because I don't want this text to be indexed, nor I want this information to be easily accessible by selecting and copying this text block.
What should be the right way to do this?
I guess turning the text to raster would be bad idea, and I don't know if there is some tool that can make only cartain text parts with special privileges.
You will need a program that can convert a font into a series of shapes.
Illustrator may have the functionality you want: see here and here.
In Word 2010 I want to add text to a document, bookmark this text and then cross reference this text in the header and footer of the document.
Can this be recorded or will I have to code it?
Yes it is possible.
Yes you can record in Word - allthough with some limitations as you can't navigate thru your text by mouse when in recording mode; the generated code will be ugly and full of "hard coding" but will give you an impression which objects, methods and properties might be relevant..
If you want a solution that is a bit more sustainable than a one-off, proper coding surely is the way to go. You should make friends with the following in order to solve your task:
the Selection object and its methods, especially GoTo, Move and its variants
the way to extend a cursor to mark text
inserting text using various Insert... methods (e.g. Selection.InsertCrossReference ReferenceType:="Bookmark" ...)
adding bookmarks to the Bookmarks collection
understanding how to manipulate headers & footers
Try some coding and come back with more sopecific questions if you get stuck.
I am using Word 2007.
I have to create a complex document using text from various sources.
What I want to do is crate template that forces all text that is pasted into the document to be coloured red but retain all other formatting properties.
Then I will be able to quickly identify any pasted text which have not had my styles applied to them.
Is it possible to use VBA to make this happen?
You would need to catch all possible paste operations in your document and make the pasted cells text red colored. Since there are several possible ways to perform copy/paste in Excel this is not a trivial task. Here is a nice discussion to get you started:
Catching Paste Operations
I am writing documentation about an app and want to explain the code.
I want to copy parts of the Objective C code from Xcode to Microsoft Word.
I don't know how to put the code with syntax highlighting (and maybe line numbers, too ?!) into Word.
Does anybody know a usable solution for this little problem?
Copy and paste works !
Nevertheless, make sure the option "Copy colors and fonts" in Preferences>Fonts & Colors is checked !
If you need this in Pages you can paste into textedit then copy/paste from textedit into pages. I have yet to find a way to paste directly into pages and preserve the text color etc
If you copy from Xcode and paste into Word you get syntax highlighting etc as expected. You just need to reduce the font size to make it more readable and avoid wrapping etc. It would probably be a good idea to define a suitable Style in Word, e.g. "Code" which would have the required font size etc for pasted code.
It supports these by default in Xcode 4. And what you need to do is to choose "Use Orignal Format" in Word or Power Point.
If you need this in Pages, then a workaround is to copy in Xcode, paste in Word, copy again and then paste in Pages (That is if you have MS Word available).