Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming,microsoft.public.excel.sdk,microsoft.public.excel.misc
|
|||
|
|||
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 |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
How to stop: Microsoft XLS is locked for editing in 2003 Excel | Excel Discussion (Misc queries) | |||
editing a data validation list | Excel Discussion (Misc queries) | |||
Editing Data Validation Input Messages | Excel Discussion (Misc queries) | |||
Excel 2003 says worksheet is locked for editing | Excel Discussion (Misc queries) | |||
editing an excel 97 file within excel 2003 and saving back as exce | Excel Discussion (Misc queries) |