Wrox Programmer Forums
Go Back   Wrox Programmer Forums > XML > XML
|
XML General XML discussions.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the XML section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old August 17th, 2006, 09:16 AM
Registered User
 
Join Date: Aug 2006
Posts: 7
Thanks: 0
Thanked 0 Times in 0 Posts
Default WordML - how to add custom information

Hi, I'm using Word 2003 to edit XML (WordML) based Word documents.

I'ld like to add custom information. Hence, I've added a custom namespace to the document element:
Code:
<w:wordDocument ... xmlns:test="test">
and, e.g., added an attribute to an existing tag:
Code:
<o:DocumentProperties test:test="test">
Unfortunately, when I save the document in Word, this attribute will get removed.
Comments will get removed, too, BTW, and apparently, it's not possible to add custom tags (Word will complain about unreadable tags).

I just need to find any type of structure where I can place some custom information that doesn't get removed by Word.

Any ideas?
Thanks
 
Old August 21st, 2006, 08:48 AM
joefawcett's Avatar
Wrox Author
 
Join Date: Jun 2003
Posts: 3,074
Thanks: 1
Thanked 38 Times in 37 Posts
Default

Have you associated a custom schema, detailing your extra elements and attributes, with the document?

--

Joe (Microsoft MVP - XML)
 
Old August 23rd, 2006, 05:23 AM
Registered User
 
Join Date: Aug 2006
Posts: 7
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Thanks for the reply.

You probably mean associating a schema as described here [1].

However, I would not need to tag visible contents, but to add invisible "meta information" to the document and some of its elements.

I.e., the Word document gets exported from a content management system. After an (external) author has edited it, the file will be re-imported into the CMS - and needs to have the information to which CMS object it has been associated, originally.
The same with images that are included with the document. They need to be re-imported into the original images in the CMS.

Tagging like described in [1] would partly work. Still, there are two problems with that in my scenario:
+ I haven't found a way to make the tags invisible. - They would need to be invisible as the potential authors have absolutely no technical skills, and know nothing about XML, etc.
+ The tags surround the document elements, i.e., images. If an author would move a tagged image (without the surrounding tags), the document would become inconsistent.

I would rather like to add attributes (or child elements) to existing Word elements.

[1] http://msdn.microsoft.com/msdnmag/is...1/XMLFiles/#S4

 
Old August 23rd, 2006, 05:44 AM
Registered User
 
Join Date: Aug 2006
Posts: 7
Thanks: 0
Thanked 0 Times in 0 Posts
Default

OK, by recording macros I found out how to
a) make the markup invisible, and
b) add a custom schema to the Word application, programmatically.

So there would be a way.

Thanks!






Similar Threads
Thread Thread Starter Forum Replies Last Post
Wordml fonts johnlaw83 XSLT 1 June 19th, 2007 09:39 AM
WordML to readable XML ROCXY XSLT 1 December 22nd, 2006 08:45 AM
add function to custom toolbar Vince_421 Access VBA 0 May 20th, 2006 10:36 AM
add a custom field to a mail item [email protected] Visual Studio 2005 0 May 15th, 2006 10:25 AM
Cannot add header information.... cmiller Beginning PHP 1 September 2nd, 2003 07:02 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.