Word Hacks [Electronic resources] نسخه متنی

اینجــــا یک کتابخانه دیجیتالی است

با بیش از 100000 منبع الکترونیکی رایگان به زبان فارسی ، عربی و انگلیسی

Word Hacks [Electronic resources] - نسخه متنی

Andrew Savikas

| نمايش فراداده ، افزودن یک نقد و بررسی
افزودن به کتابخانه شخصی
ارسال به دوستان
جستجو در متن کتاب
بیشتر
تنظیمات قلم

فونت

اندازه قلم

+ - پیش فرض

حالت نمایش

روز نیمروز شب
جستجو در لغت نامه
بیشتر
لیست موضوعات
توضیحات
افزودن یادداشت جدید







Hack 53 Sidestep Formatting Restrictions

Formatting protection can help keep documents
rigidly consistent, but sometimes you gotta break the
rules.

Word 2003 introduced formatting restrictions as
a way to restrict the kinds of formatting users can
apply to a document. To activate
formatting protection, select ToolsProtect Document. In the
Protect Document Task Pane, shown in Figure 6-5,
you can specify which types of editing and formatting restrictions to
enforce.


Figure 6-5. Setting editing and formatting restrictions in a document

When you click the "Yes, Start Enforcing
Protection" button, you can optionally supply a
password. As you're about to see, including a
password is fairly useless, but it may keep some users from futzing
with the formatting.


In general, consider the formatting restrictions about as secure as a
lock on your backyard fenceyou might keep out those looking
for a convenient shortcut, but anyone who really wants in can just
climb over.

When the formatting restrictions are in effect, none of the direct
formatting commands, such as the Bold and Italic buttons on the
toolbar, can be used. If you try, you get the message shown in Figure 6-6.


Figure 6-6. What you see when you try to format a protected document

However, you can get around this obstacle fairly easily. For example,
create a new, blank document and fill in some placeholder text [Hack #14] . From the Protect Document
Task Pane, turn on formatting protection. Many of the buttons on the
Formatting toolbar will appear grayed out.

Select some text in the document and click the Bold button.
You'll get the dialog shown in Figure 6-6. Now select
ToolsMacroVisual Basic Editor, enter the
following in the Immediate window [Hack #2],
and then press Enter:

Selection.Font.Bold = True

Go back to the document and view your formatting changes. From VBA,
you can apply any of the
"restricted" formatting in the
document.


6.4.1 Hacking the Hack


Applying some formatting with VBA is fine as a quick fix for an
unexpectedly protected document, but if you want to remove all the
formatting and editing protection from a document,
you'll need to hack the document as an RTF file.

With your "protected" document
open, go back to the Protect Document Task Pane and set the Editing
Protection to Read Only. Now select FileSave and save the
file as Rich Text Format.

Close the file from Word, and then open it in a standard text editor,
such as Notepad. Find the following two statements and remove them
from the file.

\lsdlockeddef1{\lsdlockedexcept Normal;Default Paragraph Font;HTML Top of Form;
HTML Bottom of Form;Normal Table;No List;}
\annotprot

Save and close the RTF file, and then reopen it in Word.
You'll see that the protection is no longer active.
The moral of the story? Restriction settings can help you cut down on
undesired formatting and editing, but don't rely on
them for more than superficial protection.


/ 162