[Solved] Disable read-only warning
Posted: Thu Jan 18, 2024 3:46 am
When I switch to read-only mode,I will get a warning prompt 'The document opens in read-only mode'.How to disable this feature?
User community support forum for Apache OpenOffice, LibreOffice and all the OpenOffice.org derivatives
https://forum.openoffice.org/en/forum/
https://forum.openoffice.org/en/forum/viewtopic.php?t=111134
Code: Select all
java.io.File sourceFile = new java.io.File(filePath);
StringBuffer sTemplateFileUrl = new StringBuffer("file:///");
sTemplateFileUrl.append(sourceFile.getCanonicalPath().replace('\\', '/'));
String loadUrl = sTemplateFileUrl.toString();
PropertyValue[] loadProps = new PropertyValue[3];
loadProps[0] = new PropertyValue();
loadProps[0].Name = "AsTemplate";
loadProps[0].Value = false;
loadProps[1] = new PropertyValue();
loadProps[1].Name = "Hidden";
loadProps[1].Value = false;
loadProps[2] = new PropertyValue();
loadProps[2].Name = "ReadOnly";
loadProps[2].Value = true;
//Get the office process to load the URL
aBean.loadFromURL( loadUrl, loadProps );
Code: Select all
DIM props(0) as NEW com.sun.star.beans.PropertyValue
props(0).Name = "ReadOnly"
props(0).Value = TRUE
oDoc = StarDesktop.loadComponentFromURL(convertToURL("C:\Users\fjcc\Desktop\forumAnswer.odt"), 0, "_blank", props())