D
David Thielen
I see this error in the following code:
foreach (InlineShape item in
range.InlineShapes)
{
try
{
if ((item.Range.End <=
startSearch) || (endSearch <= item.Range.Start))
continue;
// chart (with tag)?
if (item.HasChart ==
MsoTriState.msoTrue)
{
// fast check
if
(string.IsNullOrEmpty(item.AlternativeText) ||
((!item.AlternativeText.StartsWith("<wr:")) &&
(!item.AlternativeText.StartsWith("</wr:"))))
continue;
string
xmlChart = item.Range.WordOpenXML;
On the call to WordOpenXML I get a COMException of:
- $exception {"The object is not valid."}
System.Exception {System.Runtime.InteropServices.COMException}
What's really screwy is in the debugger I can then do a Quickwatch on
"item.Range.WordOpenXML" and I get the string - no exception.
Then when I say continue I get:
System.AccessViolationException occurred
Message="Attempted to read or write protected memory. This is often
an indication that other memory is corrupt."
Source="Microsoft.Office.Interop.Word"
StackTrace:
at Microsoft.Office.Interop.Word.Range.get_ShapeRange()
at
AutoTag2010.net.windward.autotag.word.WordTagHandler.FindAllTags(Selection
selOn, Boolean justFirst, Int32 startSearch, Int32 endSearch) in
C:\src\version9\AutoTag\AutoTag2010\net\windward\autotag\word\WordTagHandler.cs:line
677
InnerException:
And Word is basically hosed - I need to exit it.
Any idea why?
thanks - dave
david@[email protected]
Windward Reports -- http://www.WindwardReports.com
me -- http://dave.thielen.com
Cubicle Wars - http://www.windwardreports.com/film.htm
foreach (InlineShape item in
range.InlineShapes)
{
try
{
if ((item.Range.End <=
startSearch) || (endSearch <= item.Range.Start))
continue;
// chart (with tag)?
if (item.HasChart ==
MsoTriState.msoTrue)
{
// fast check
if
(string.IsNullOrEmpty(item.AlternativeText) ||
((!item.AlternativeText.StartsWith("<wr:")) &&
(!item.AlternativeText.StartsWith("</wr:"))))
continue;
string
xmlChart = item.Range.WordOpenXML;
On the call to WordOpenXML I get a COMException of:
- $exception {"The object is not valid."}
System.Exception {System.Runtime.InteropServices.COMException}
What's really screwy is in the debugger I can then do a Quickwatch on
"item.Range.WordOpenXML" and I get the string - no exception.
Then when I say continue I get:
System.AccessViolationException occurred
Message="Attempted to read or write protected memory. This is often
an indication that other memory is corrupt."
Source="Microsoft.Office.Interop.Word"
StackTrace:
at Microsoft.Office.Interop.Word.Range.get_ShapeRange()
at
AutoTag2010.net.windward.autotag.word.WordTagHandler.FindAllTags(Selection
selOn, Boolean justFirst, Int32 startSearch, Int32 endSearch) in
C:\src\version9\AutoTag\AutoTag2010\net\windward\autotag\word\WordTagHandler.cs:line
677
InnerException:
And Word is basically hosed - I need to exit it.
Any idea why?
thanks - dave
david@[email protected]
Windward Reports -- http://www.WindwardReports.com
me -- http://dave.thielen.com
Cubicle Wars - http://www.windwardreports.com/film.htm