public override bool ProcessWordByWord(OfficeDocumentProcessor aWordProcessor) { Document.MoveFirst(); // to avoid an error on the first 'Edit' int nDontCare = 0; // don't care while (!Document.EOF) { dao.Fields aFields = Document.Fields; dao.Field aField = aFields[m_strFieldName]; if (aField.Value != System.DBNull.Value) { AccessRange aWordRange = new AccessRange(aField, this); try { if (!aWordProcessor.Process(aWordRange, ref nDontCare)) { return(false); } } catch (Exception) { throw; } finally { // this gets called whether we successfully process the word or not, // whether we're returning 'false' (in the try) or not, and whether we // have an exception or not... just exactly what we want, or MSAccess // process won't release when we exit. OfficeApp.ReleaseComObject(aField); OfficeApp.ReleaseComObject(aFields); } } Document.MoveNext(); } return(true); }
public override bool ProcessWordByWord(OfficeDocumentProcessor aWordProcessor) { Document.MoveFirst(); // to avoid an error on the first 'Edit' int nDontCare = 0; // don't care while (!Document.EOF) { dao.Fields aFields = Document.Fields; dao.Field aField = aFields[m_strFieldName]; if (aField.Value != System.DBNull.Value) { AccessRange aWordRange = new AccessRange(aField, this); try { if (!aWordProcessor.Process(aWordRange, ref nDontCare)) return false; } catch (Exception) { throw; } finally { // this gets called whether we successfully process the word or not, // whether we're returning 'false' (in the try) or not, and whether we // have an exception or not... just exactly what we want, or MSAccess // process won't release when we exit. OfficeApp.ReleaseComObject(aField); OfficeApp.ReleaseComObject(aFields); } } Document.MoveNext(); } return true; }