I have an issue with my Calc addin where whenever any
workbook is opened,
even if *nothing* is changed on the sheet, when you close
workbook you get
prompted to save the workbook. I have traced the code to a
call to
XNameContainer.insertByName(). Here is a code snippet:
//====================================================
// get XFormsSupplier from from XFormsSupplier off of sheet
XNameContainer xForms = getSheetForms(xSheet);
// return now if no XNameContainer
if (xForms == null) {
return;
}
Object oForm = null;
Object oControl = null;
try {
// get the form
oForm = xForms.getByName("__MY_FORM__");
} catch (com.sun.star.container.NoSuchElementException ex) {
// form has not been created -> create
try {
// create a dataform using the current context
oForm =
SOContext.createServiceInstance("com.sun.star.form.com
ponent.DataForm",
null);
// DEBUG - if line below is uncommented, no prompt for
save
// if (true) return;
xForms.insertByName("__MY_FORM__", oForm);
// DEBUG - if line below is uncommented (and return
statement
// above is), prompt for save occurs
if (true) return;
//====================================================
I can understand that inserting this object changes the
worksheet, but is
there a way to prevent it from marking the workbook as
'dirty' (so users
don't get prompted to save the workbook merely because of
this change?)
Alternatively, is there an equivilent to the Excel VBA
Workbook.Saved
property? Here is a a help file snippet from VBA:
"You can set this property to True if you want to
close a modified workbook
without either saving it or being prompted to save
it."
Tim
Tim Tow
Applied OLAP, Inc
256.990.0136
------------------------------------------------------------
---------
To unsubscribe, e-mail: dev-unsubscribe api.openoffice.org
For additional commands, e-mail: dev-help api.openoffice.org
|