Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming,microsoft.public.excel.sdk,microsoft.public.excel.misc
external usenet poster
 
Posts: 1
Default Excel 2003: XML Validation upon editing ?

(I'm passing along info from someone more technical with whom I've
spoken...]

Does anyone know if it is possible to specify that validation must be
performed everytime the content of a mapped cell is modified ?


Yes, Excel does not do real-time validation. You could use Excel's
validation capability [Data | Validation] or write code to respond to the
Worksheet.Change event. It is also possible to write code to contain the XML
in a DOM and update the DOM for each Change event performing the validation
after the update - although this would be performant it would be a
challenge to implement. The schemas for the mapping can be obtianed from
the XmlMap.Schemas collection object.

Also, when validation fails during export, the XML file is still created
(although a warning is issued). Does anyone know if there is a property

that
can be set to tell Excel to abort export if the validation fails ?


The only way to PREVENT the export is to handle the before XmlExport event.
Within that event you would perform an XmlMap.ExportXml and validate the
returned value. If the content is not valid set the cancel attribute to
true. Clearly this would not give the best performance, since Excel would
simply perform the whole export operation again in the event the export is
not cancelled by the before event handler. Alternatively, you could allow
the export to file to happen and during the after export event validate the
file.

--
Joe Andreshak, Microsoft Product Manager
This post is provided "AS IS" with no warranties, and confers no rights
Sample code subject to http://www.microsoft.com/info/cpyright.htm
----------------------------------------

"Cyril Mathey" wrote in message
...
Hello all,

I am currently investigating the new XML mapping facilities included in
Excel 2003.

From what I understand, the contents of cells that are mapped to a XML
schema element is only validated when one Import or Export data from/to an
XML file.

Does anyone know if it is possible to specify that validation must be
performed everytime the content of a mapped cell is modified ?

Currently, the only soulution I see is to use VBA or Interop and perform

the
consistency check in a Change handler. However, this solution implies that
we have the schema object model to validate element/attribute values, so

I'd
rather let Excel do the job :)

Also, when validation fails during export, the XML file is still created
(although a warning is issued). Does anyone know if there is a property

that
can be set to tell Excel to abort export if the validation fails ?

Thanks for any hint

--
Cyril






Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
How to stop: Microsoft XLS is locked for editing in 2003 Excel shorns Excel Discussion (Misc queries) 1 January 28th 10 06:23 PM
editing a data validation list dslocum[_5_] Excel Discussion (Misc queries) 2 January 26th 09 01:43 PM
Editing Data Validation Input Messages Shelley Excel Discussion (Misc queries) 0 August 17th 07 01:54 AM
Excel 2003 says worksheet is locked for editing Aimee Excel Discussion (Misc queries) 2 August 31st 06 12:35 AM
editing an excel 97 file within excel 2003 and saving back as exce Chris Egebrecht Excel Discussion (Misc queries) 3 March 24th 06 11:14 PM


All times are GMT +1. The time now is 01:40 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"