Delete formfield/ protect document

Hi

I need to create a read only document. Word’s read only feature is not good enough in that you can make changes and then Save As.

I am creating a web form dynamically from a Word template, using form fields to indicate where I should create text/check boxes or RADEditors. User input is saved. When I create a Word document from a template, I then insert the form field values from the database (to support workflow).

builder.MoveToBookmark(formField.Name, False, True)
builder.InsertHtml(html)
formField.Result = ""
builder.Document.Range.Bookmarks.Remove(formField.Name)
builder.Document.Protect(Aspose.Word.ProtectionType.AllowOnlyFormFields)

Remove bookmark does not delete form fields. Other protection types still allow selecting and copying of text, which I want to disable.

Also, in the Object Browser, my reference to Aspose gives all kinds of strange namespaces - Xenocode, squares. I thought the dll was corrupt but I tried downloading several versions over time with the same result.

Thanks gwe

Hi,

Thank you for your interest in Aspose.

  1. Sorry, we cannot implement a protection not supported by MS Word. So the best protection for you is Allow Form Fields Only as the user cannot select and copy text with this protection.

  2. We have logged the deleting of the form field through a bookmark, but it’s impossible to say at the moment when it will be fixed.

  3. Squares and other garbage in the Object Browser are related to the problems with obfuscation, but they have been fixed in some of the recent versions. Please make sure that you are using the latest one.

Thanks Dmitry,

1,2. I hope it is fixed soon.

  1. I have version 2.3, and I still have this problem. I’ve downloaded it several times. I’m using VS Enterprise Architect 2003. Is there any other information you need?

gwe

This is very strange. Is it possible that your proxy server did not let the updates to come through? Please make sure once more that you are using version 2.3 by right-clicking on Aspose.Word.dll.

Hi

I do indeed have 2.3. I re-downloaded it, and it was not cached by the proxy server. I’ve checked my project references, checked the version as you suggested, and checked in the object browser that I had the new modifications mentioned in the release notes for 2.3. What now?

Thanks gwe

Sorry, there is still indeed a problem with obfuscation in VB .NET projects. C# projects do not have this. We’ll try to fix it asap, thank you for the request.

Our obfuscator vendor has confirmed it is a problem either in their tool or in VS.NET that the Object Browser shows obfuscated namespaces and classes when used for a VB.NET project. They are looking into the issue. Just ignore all of the extra obfuscated names for now.

If you use Bookmarks.Remove(bookmarkName) then it only removes the bookmark itself, not the part of the document it covers.

You should try using Bookmarks[bookmarkName].Text = "";

This will remove the contents of the bookmark.