| View previous topic :: View next topic |
| Author |
Message |
uros Super User


Joined: 22 May 2003 Posts: 601 Location: Slovenia
|
Posted: Thu May 22, 2003 5:15 am Post subject: Page format for spreadsheet |
|
|
Hello!
My problem is how to set page format for a spredsheet (paper orientation, page margins, headers, scale,....).
I'm programming in Basic, didn't found anything in SO programming tutorial and SDK developers guide.
Thank's for any help.
Uros |
|
| Back to top |
|
 |
The Liquidator Super User


Joined: 27 Feb 2003 Posts: 1368 Location: Manchester, UK
|
Posted: Thu May 22, 2003 2:22 pm Post subject: |
|
|
Are you saying that you want to set a spreadsheet style and then for all new sheets to be based upon that? If so, I think you are thinking on too high a plane as it's a fairly basic (pardon the pun!) function.
1. Set up the spreadsheet how you want it within calc
2. Save the doc in SO speadsheet format - best place is in the OOo\user\template directory. Give it a name (my spreadsheet for example).
3. Select file\templates\organise and in the dialog box open the "default" directory. An icon for your newly saved template will be shown. Select "use as default" and thereafter every time you select "new spreadsheet" it will be based on that.
That help?
Ian |
|
| Back to top |
|
 |
The Liquidator Super User


Joined: 27 Feb 2003 Posts: 1368 Location: Manchester, UK
|
Posted: Thu May 22, 2003 2:24 pm Post subject: |
|
|
Are you saying that you want to set a spreadsheet style and then for all new sheets to be based upon that? If so, I think you are thinking on too high a plane as it's a fairly basic (pardon the pun!) function.
1. Set up the spreadsheet how you want it within calc - all the functions to which you refer are available (most within format\page)
2. Save the doc in SO speadsheet format - best place is in the OOo\user\template directory. Give it a name (my spreadsheet for example).
3. Select file\templates\organise and in the dialog box open the "default" directory. An icon for your newly saved template will be shown. Select "use as default" and thereafter every time you select "new spreadsheet" it will be based on that.
That help?
Ian |
|
| Back to top |
|
 |
Guest
|
Posted: Thu May 22, 2003 10:22 pm Post subject: |
|
|
Thanks for your advice.
Template is a good and usefull idea, but I have something else on my mind.
I'd like to write a generic function in Basic using Uno services to call it at the diferent occasions with different parameters.
Could you help me with that?
Uros |
|
| Back to top |
|
 |
The Liquidator Super User


Joined: 27 Feb 2003 Posts: 1368 Location: Manchester, UK
|
Posted: Fri May 23, 2003 4:22 am Post subject: |
|
|
Hi
Sorry, I know nothing about programming |
|
| Back to top |
|
 |
Guest
|
Posted: Thu Aug 07, 2003 12:56 am Post subject: |
|
|
Hi guys
I was using "dispose" function of OOo basic to close the spreadsheet through its own macro but at one place it is working correctly while at other it is giving the error message that 'an irrecoverable error has occurred all files will be saved........' Can anyone tell me, please, what could have been the error. I am enclosing the macro for your reference. Is there any other option to dispose function?? | Code: | Dim Filternames$(1,1)
Dim ListAn(0) as Long
Filternames(0,0) = "Openoffice.org 1.0 Spreadsheet"
Filternames(0,1) = "*.sxc"
Filternames(1,0) = "StarCalc 5.0"
Filternames(1,1) = "*.sdc"
ListAn(0) = com.sun.star.ui.dialogs.TemplateDescription.FILEOPEN_SIMPLE
oOpenDialog = CreateUnoService("com.sun.star.ui.dialogs.FilePicker")
oOpenDialog.Initialize(ListAn())
AddFiltersToDialog(FilterNames(), oOpenDialog)
DisplayDirectory = "file:///MyComputer/Project/users/mg/"
oOpenDialog.SetDisplayDirectory(DisplayDirectory)
DefaultName = "xxx.sxc"
oOpenDialog.SetDefaultName(DefaultName)
Line1: iAccept = oOpenDialog.Execute()
If iAccept = 1 Then
File_Name = oOpenDialog.Files(0)
Dim args(2) as new com.sun.star.beans.PropertyValue
args(0).Name = "Overwrite"
args(0).Value = false
args(1).Name = "Hidden"
args(1).Value = false
oDoc1 = OpenDocument(File_Name,args())
else
Svar = MsgBox("Exiting the PFA development package",64,"PFA")
numb = 1
On numb Goto Disposing
endif
oSheets = oDoc1.getSheets()
oSheet11 = oSheets.getByName("Inputs")
oCell1 = oSheet11.getCellByPosition(1,0)
if StrComp(oCell1.STRING,"")=0 then
Svar = MsgBox("Enter the correct path of the PFA file you want to modify",16,"Wrong File Name")
count = 1
oDoc1.dispose()
On count goto Line1
endif
Dim NoArgs() as New com.sun.star.beans.PropertyValue
Dim oStoreProperties(0) as New com.sun.star.beans.PropertyValue
Dim oStoreDialog as Object
Dim iAccept1 as Integer
Dim sPath as String
Dim ListAny(0) as Long
Dim UIFilterName as String
Dim FilterName as String
Dim FilterIndex as Integer
ListAny(0) = com.sun.star.ui.dialogs.TemplateDescription.FILESAVE_AUTOEXTENSION_PASSWORD_FILTEROPTIONS
oStoreDialog = CreateUnoService("com.sun.star.ui.dialogs.FilePicker")
oStoreDialog.Initialize(ListAny())
AddFiltersToDialog(FilterNames(), oStoreDialog)
oStoreDialog.SetDisplayDirectory("file:///MyComputer/Project/users/mg/")
oStoreDialog.SetDefaultName("xxx.sxc")
iAccept1 = oStoreDialog.Execute()
If iAccept1 = 1 Then
sPath = oStoreDialog.Files(0)
UIFilterName = oStoreDialog.GetCurrentFilter()
FilterIndex = IndexInArray(UIFilterName, FilterNames())
FilterName = FilterNames(FilterIndex,2)
Cell_Prjcd = oSheet11.getCellByPosition(2,249)
Dim args2(1) as new com.sun.star.beans.PropertyValue
args2(0).Name = "Hidden"
args2(0).Value = true
count = 0
oDoc2 = OpenDocument("file:///MyComputer/Project/users/mg/personal/pfa_DB.sxc",args2())
While (oDoc2.isProtected()=true)
oDoc2.dispose()
count = count + 1
oDoc2 = OpenDocument("file:///MyComputer/Project/users/mg/personal/pfa_DB.sxc",args2())
wend
oDoc2.Protect("")
oDoc2.store()
oSheets20 = oDoc2.getSheets()
oSheet21 = oSheets20.getByName("Sheet1")
oCell_Range = oSheet21.getCellRangeByPosition(1,2,1,51)
oCell_Ranges = oCell_Range.queryVisibleCells()
oCells1 = oCell_Ranges.getCells()
oCell_Enum = oCells1.CreateEnumeration()
sChoice = 0
while (oCell_Enum.hasMoreElements())
object1 = oCell_Enum.nextElement()
if (object1.getValue()=oCell_Prjcd.getValue()) then
obj_add = object1.getCellAddress()
oCell_Name = oSheet21.getCellByPosition(obj_add.Column+1,obj_add.Row)
Proj_Name = oCell_Name.STRING
oCell_Mod = oSheet21.getCellByPosition(obj_add.Column+2,obj_add.Row)
curr_mod = oCell_Mod.getValue()
if (curr_mod)=999 then
curr_mod = 0
suf = "st time"
elseif (curr_mod+1)=2 then
suf = "nd time"
elseif (curr_mod+1)=3 then
suf = "rd time"
else
suf = "th time"
endif
sChoice = MsgBox("You are going to modify PFA for this project for the "+(curr_mod+1)+suf+". Continue(Yes/No)",32+4,"Information")
endif
wend
if sChoice=6 then
oCell_Mod.setValue(curr_mod+1)
oDoc2.Unprotect("")
oDoc2.store()
oDoc2.dispose()
elseif sChoice=7 then
Svar = MsgBox("Exiting the PFA development package",64,"PFA")
oDoc2.Unprotect("")
oDoc1.dispose()
oDoc2.store()
oDoc2.dispose()
numb = 1
On numb Goto Disposing
else
Svar = MsgBox("Invalid file selected. Exiting package. Try again...")
oDoc2.Unprotect("")
oDoc1.dispose()
oDoc2.store()
oDoc2.dispose()
numb = 1
On numb Goto Disposing
endif
On Local Error Goto NOSAVING
If FilterName = "" Then
oDoc1.StoreAsUrl(sPath, NoArgs())
Else
oStoreProperties(0).Name = "FilterName"
oStoreProperties(0).Value = FilterName
oDoc1.StoreAsUrl(sPath, oStoreProperties())
End If
Else
Svar = MsgBox("Exiting the PFA development package",64,"PFA")
oDoc1.dispose()
numb = 1
On numb Goto Disposing
End If
NOSAVING:
If Err <> 0 Then
Msgbox("Document cannot be saved under '" & ConvertFromUrl(sPath) & "'", 48, GetProductName())
sPath = ""
Resume NOERROR
NOERROR:
oDoc1.dispose()
End If
Disposing:
oDoc.dispose() |
Here only call to "oDoc.dispose() " leads to the error message. |
|
| Back to top |
|
 |
Guest
|
Posted: Thu Aug 07, 2003 12:59 am Post subject: |
|
|
Hi guys
I was using "dispose" function of OOo basic to close the spreadsheet through its own macro but at one place it is working correctly while at other it is giving the error message that 'an irrecoverable error has occurred all files will be saved........' Can anyone tell me, please, what could have been the error. I am enclosing the macro for your reference. Is there any other option to dispose function?? | Code: | Dim Filternames$(1,1)
Dim ListAn(0) as Long
Filternames(0,0) = "Openoffice.org 1.0 Spreadsheet"
Filternames(0,1) = "*.sxc"
Filternames(1,0) = "StarCalc 5.0"
Filternames(1,1) = "*.sdc"
ListAn(0) = com.sun.star.ui.dialogs.TemplateDescription.FILEOPEN_SIMPLE
oOpenDialog = CreateUnoService("com.sun.star.ui.dialogs.FilePicker")
oOpenDialog.Initialize(ListAn())
AddFiltersToDialog(FilterNames(), oOpenDialog)
DisplayDirectory = "file:///MyComputer/Project/users/mg/"
oOpenDialog.SetDisplayDirectory(DisplayDirectory)
DefaultName = "xxx.sxc"
oOpenDialog.SetDefaultName(DefaultName)
Line1: iAccept = oOpenDialog.Execute()
If iAccept = 1 Then
File_Name = oOpenDialog.Files(0)
Dim args(2) as new com.sun.star.beans.PropertyValue
args(0).Name = "Overwrite"
args(0).Value = false
args(1).Name = "Hidden"
args(1).Value = false
oDoc1 = OpenDocument(File_Name,args())
else
Svar = MsgBox("Exiting the PFA development package",64,"PFA")
numb = 1
On numb Goto Disposing
endif
oSheets = oDoc1.getSheets()
oSheet11 = oSheets.getByName("Inputs")
oCell1 = oSheet11.getCellByPosition(1,0)
if StrComp(oCell1.STRING,"")=0 then
Svar = MsgBox("Enter the correct path of the PFA file you want to modify",16,"Wrong File Name")
count = 1
oDoc1.dispose()
On count goto Line1
endif
Dim NoArgs() as New com.sun.star.beans.PropertyValue
Dim oStoreProperties(0) as New com.sun.star.beans.PropertyValue
Dim oStoreDialog as Object
Dim iAccept1 as Integer
Dim sPath as String
Dim ListAny(0) as Long
Dim UIFilterName as String
Dim FilterName as String
Dim FilterIndex as Integer
ListAny(0) = com.sun.star.ui.dialogs.TemplateDescription.FILESAVE_AUTOEXTENSION_PASSWORD_FILTEROPTIONS
oStoreDialog = CreateUnoService("com.sun.star.ui.dialogs.FilePicker")
oStoreDialog.Initialize(ListAny())
AddFiltersToDialog(FilterNames(), oStoreDialog)
oStoreDialog.SetDisplayDirectory("file:///MyComputer/Project/users/mg/")
oStoreDialog.SetDefaultName("xxx.sxc")
iAccept1 = oStoreDialog.Execute()
If iAccept1 = 1 Then
sPath = oStoreDialog.Files(0)
UIFilterName = oStoreDialog.GetCurrentFilter()
FilterIndex = IndexInArray(UIFilterName, FilterNames())
FilterName = FilterNames(FilterIndex,2)
Cell_Prjcd = oSheet11.getCellByPosition(2,249)
Dim args2(1) as new com.sun.star.beans.PropertyValue
args2(0).Name = "Hidden"
args2(0).Value = true
count = 0
oDoc2 = OpenDocument("file:///MyComputer/Project/users/mg/personal/pfa_DB.sxc",args2())
While (oDoc2.isProtected()=true)
oDoc2.dispose()
count = count + 1
oDoc2 = OpenDocument("file:///MyComputer/Project/users/mg/personal/pfa_DB.sxc",args2())
wend
oDoc2.Protect("")
oDoc2.store()
oSheets20 = oDoc2.getSheets()
oSheet21 = oSheets20.getByName("Sheet1")
oCell_Range = oSheet21.getCellRangeByPosition(1,2,1,51)
oCell_Ranges = oCell_Range.queryVisibleCells()
oCells1 = oCell_Ranges.getCells()
oCell_Enum = oCells1.CreateEnumeration()
sChoice = 0
while (oCell_Enum.hasMoreElements())
object1 = oCell_Enum.nextElement()
if (object1.getValue()=oCell_Prjcd.getValue()) then
obj_add = object1.getCellAddress()
oCell_Name = oSheet21.getCellByPosition(obj_add.Column+1,obj_add.Row)
Proj_Name = oCell_Name.STRING
oCell_Mod = oSheet21.getCellByPosition(obj_add.Column+2,obj_add.Row)
curr_mod = oCell_Mod.getValue()
if (curr_mod)=999 then
curr_mod = 0
suf = "st time"
elseif (curr_mod+1)=2 then
suf = "nd time"
elseif (curr_mod+1)=3 then
suf = "rd time"
else
suf = "th time"
endif
sChoice = MsgBox("You are going to modify PFA for this project for the "+(curr_mod+1)+suf+". Continue(Yes/No)",32+4,"Information")
endif
wend
if sChoice=6 then
oCell_Mod.setValue(curr_mod+1)
oDoc2.Unprotect("")
oDoc2.store()
oDoc2.dispose()
elseif sChoice=7 then
Svar = MsgBox("Exiting the PFA development package",64,"PFA")
oDoc2.Unprotect("")
oDoc1.dispose()
oDoc2.store()
oDoc2.dispose()
numb = 1
On numb Goto Disposing
else
Svar = MsgBox("Invalid file selected. Exiting package. Try again...")
oDoc2.Unprotect("")
oDoc1.dispose()
oDoc2.store()
oDoc2.dispose()
numb = 1
On numb Goto Disposing
endif
On Local Error Goto NOSAVING
If FilterName = "" Then
oDoc1.StoreAsUrl(sPath, NoArgs())
Else
oStoreProperties(0).Name = "FilterName"
oStoreProperties(0).Value = FilterName
oDoc1.StoreAsUrl(sPath, oStoreProperties())
End If
Else
Svar = MsgBox("Exiting the PFA development package",64,"PFA")
oDoc1.dispose()
numb = 1
On numb Goto Disposing
End If
NOSAVING:
If Err <> 0 Then
Msgbox("Document cannot be saved under '" & ConvertFromUrl(sPath) & "'", 48, GetProductName())
sPath = ""
Resume NOERROR
NOERROR:
oDoc1.dispose()
End If
Disposing:
oDoc.dispose() |
Here only call to "oDoc.dispose() " leads to the error message. |
|
| Back to top |
|
 |
Guest
|
Posted: Thu Aug 07, 2003 1:00 am Post subject: |
|
|
Hi guys
I was using "dispose" function of OOo basic to close the spreadsheet through its own macro but at one place it is working correctly while at other it is giving the error message that 'an irrecoverable error has occurred all files will be saved........' Can anyone tell me, please, what could have been the error. I am enclosing the macro for your reference. Is there any other option to dispose function?? | Code: | Dim Filternames$(1,1)
Dim ListAn(0) as Long
Filternames(0,0) = "Openoffice.org 1.0 Spreadsheet"
Filternames(0,1) = "*.sxc"
Filternames(1,0) = "StarCalc 5.0"
Filternames(1,1) = "*.sdc"
ListAn(0) = com.sun.star.ui.dialogs.TemplateDescription.FILEOPEN_SIMPLE
oOpenDialog = CreateUnoService("com.sun.star.ui.dialogs.FilePicker")
oOpenDialog.Initialize(ListAn())
AddFiltersToDialog(FilterNames(), oOpenDialog)
DisplayDirectory = "file:///MyComputer/Project/users/mg/"
oOpenDialog.SetDisplayDirectory(DisplayDirectory)
DefaultName = "xxx.sxc"
oOpenDialog.SetDefaultName(DefaultName)
Line1: iAccept = oOpenDialog.Execute()
If iAccept = 1 Then
File_Name = oOpenDialog.Files(0)
Dim args(2) as new com.sun.star.beans.PropertyValue
args(0).Name = "Overwrite"
args(0).Value = false
args(1).Name = "Hidden"
args(1).Value = false
oDoc1 = OpenDocument(File_Name,args())
else
Svar = MsgBox("Exiting the PFA development package",64,"PFA")
numb = 1
On numb Goto Disposing
endif
oSheets = oDoc1.getSheets()
oSheet11 = oSheets.getByName("Inputs")
oCell1 = oSheet11.getCellByPosition(1,0)
if StrComp(oCell1.STRING,"")=0 then
Svar = MsgBox("Enter the correct path of the PFA file you want to modify",16,"Wrong File Name")
count = 1
oDoc1.dispose()
On count goto Line1
endif
Dim NoArgs() as New com.sun.star.beans.PropertyValue
Dim oStoreProperties(0) as New com.sun.star.beans.PropertyValue
Dim oStoreDialog as Object
Dim iAccept1 as Integer
Dim sPath as String
Dim ListAny(0) as Long
Dim UIFilterName as String
Dim FilterName as String
Dim FilterIndex as Integer
ListAny(0) = com.sun.star.ui.dialogs.TemplateDescription.FILESAVE_AUTOEXTENSION_PASSWORD_FILTEROPTIONS
oStoreDialog = CreateUnoService("com.sun.star.ui.dialogs.FilePicker")
oStoreDialog.Initialize(ListAny())
AddFiltersToDialog(FilterNames(), oStoreDialog)
oStoreDialog.SetDisplayDirectory("file:///MyComputer/Project/users/mg/")
oStoreDialog.SetDefaultName("xxx.sxc")
iAccept1 = oStoreDialog.Execute()
If iAccept1 = 1 Then
sPath = oStoreDialog.Files(0)
UIFilterName = oStoreDialog.GetCurrentFilter()
FilterIndex = IndexInArray(UIFilterName, FilterNames())
FilterName = FilterNames(FilterIndex,2)
Cell_Prjcd = oSheet11.getCellByPosition(2,249)
Dim args2(1) as new com.sun.star.beans.PropertyValue
args2(0).Name = "Hidden"
args2(0).Value = true
count = 0
oDoc2 = OpenDocument("file:///MyComputer/Project/users/mg/personal/pfa_DB.sxc",args2())
While (oDoc2.isProtected()=true)
oDoc2.dispose()
count = count + 1
oDoc2 = OpenDocument("file:///MyComputer/Project/users/mg/personal/pfa_DB.sxc",args2())
wend
oDoc2.Protect("")
oDoc2.store()
oSheets20 = oDoc2.getSheets()
oSheet21 = oSheets20.getByName("Sheet1")
oCell_Range = oSheet21.getCellRangeByPosition(1,2,1,51)
oCell_Ranges = oCell_Range.queryVisibleCells()
oCells1 = oCell_Ranges.getCells()
oCell_Enum = oCells1.CreateEnumeration()
sChoice = 0
while (oCell_Enum.hasMoreElements())
object1 = oCell_Enum.nextElement()
if (object1.getValue()=oCell_Prjcd.getValue()) then
obj_add = object1.getCellAddress()
oCell_Name = oSheet21.getCellByPosition(obj_add.Column+1,obj_add.Row)
Proj_Name = oCell_Name.STRING
oCell_Mod = oSheet21.getCellByPosition(obj_add.Column+2,obj_add.Row)
curr_mod = oCell_Mod.getValue()
if (curr_mod)=999 then
curr_mod = 0
suf = "st time"
elseif (curr_mod+1)=2 then
suf = "nd time"
elseif (curr_mod+1)=3 then
suf = "rd time"
else
suf = "th time"
endif
sChoice = MsgBox("You are going to modify PFA for this project for the "+(curr_mod+1)+suf+". Continue(Yes/No)",32+4,"Information")
endif
wend
if sChoice=6 then
oCell_Mod.setValue(curr_mod+1)
oDoc2.Unprotect("")
oDoc2.store()
oDoc2.dispose()
elseif sChoice=7 then
Svar = MsgBox("Exiting the PFA development package",64,"PFA")
oDoc2.Unprotect("")
oDoc1.dispose()
oDoc2.store()
oDoc2.dispose()
numb = 1
On numb Goto Disposing
else
Svar = MsgBox("Invalid file selected. Exiting package. Try again...")
oDoc2.Unprotect("")
oDoc1.dispose()
oDoc2.store()
oDoc2.dispose()
numb = 1
On numb Goto Disposing
endif
On Local Error Goto NOSAVING
If FilterName = "" Then
oDoc1.StoreAsUrl(sPath, NoArgs())
Else
oStoreProperties(0).Name = "FilterName"
oStoreProperties(0).Value = FilterName
oDoc1.StoreAsUrl(sPath, oStoreProperties())
End If
Else
Svar = MsgBox("Exiting the PFA development package",64,"PFA")
oDoc1.dispose()
numb = 1
On numb Goto Disposing
End If
NOSAVING:
If Err <> 0 Then
Msgbox("Document cannot be saved under '" & ConvertFromUrl(sPath) & "'", 48, GetProductName())
sPath = ""
Resume NOERROR
NOERROR:
oDoc1.dispose()
End If
Disposing:
oDoc.dispose() |
Here only call to "oDoc.dispose() " leads to the error message. |
|
| Back to top |
|
 |
Guest
|
Posted: Thu Aug 07, 2003 1:00 am Post subject: |
|
|
Hi guys
I was using "dispose" function of OOo basic to close the spreadsheet through its own macro but at one place it is working correctly while at other it is giving the error message that 'an irrecoverable error has occurred all files will be saved........' Can anyone tell me, please, what could have been the error. I am enclosing the macro for your reference. Is there any other option to dispose function?? | Code: | Dim Filternames$(1,1)
Dim ListAn(0) as Long
Filternames(0,0) = "Openoffice.org 1.0 Spreadsheet"
Filternames(0,1) = "*.sxc"
Filternames(1,0) = "StarCalc 5.0"
Filternames(1,1) = "*.sdc"
ListAn(0) = com.sun.star.ui.dialogs.TemplateDescription.FILEOPEN_SIMPLE
oOpenDialog = CreateUnoService("com.sun.star.ui.dialogs.FilePicker")
oOpenDialog.Initialize(ListAn())
AddFiltersToDialog(FilterNames(), oOpenDialog)
DisplayDirectory = "file:///MyComputer/Project/users/mg/"
oOpenDialog.SetDisplayDirectory(DisplayDirectory)
DefaultName = "xxx.sxc"
oOpenDialog.SetDefaultName(DefaultName)
Line1: iAccept = oOpenDialog.Execute()
If iAccept = 1 Then
File_Name = oOpenDialog.Files(0)
Dim args(2) as new com.sun.star.beans.PropertyValue
args(0).Name = "Overwrite"
args(0).Value = false
args(1).Name = "Hidden"
args(1).Value = false
oDoc1 = OpenDocument(File_Name,args())
else
Svar = MsgBox("Exiting the PFA development package",64,"PFA")
numb = 1
On numb Goto Disposing
endif
oSheets = oDoc1.getSheets()
oSheet11 = oSheets.getByName("Inputs")
oCell1 = oSheet11.getCellByPosition(1,0)
if StrComp(oCell1.STRING,"")=0 then
Svar = MsgBox("Enter the correct path of the PFA file you want to modify",16,"Wrong File Name")
count = 1
oDoc1.dispose()
On count goto Line1
endif
Dim NoArgs() as New com.sun.star.beans.PropertyValue
Dim oStoreProperties(0) as New com.sun.star.beans.PropertyValue
Dim oStoreDialog as Object
Dim iAccept1 as Integer
Dim sPath as String
Dim ListAny(0) as Long
Dim UIFilterName as String
Dim FilterName as String
Dim FilterIndex as Integer
ListAny(0) = com.sun.star.ui.dialogs.TemplateDescription.FILESAVE_AUTOEXTENSION_PASSWORD_FILTEROPTIONS
oStoreDialog = CreateUnoService("com.sun.star.ui.dialogs.FilePicker")
oStoreDialog.Initialize(ListAny())
AddFiltersToDialog(FilterNames(), oStoreDialog)
oStoreDialog.SetDisplayDirectory("file:///MyComputer/Project/users/mg/")
oStoreDialog.SetDefaultName("xxx.sxc")
iAccept1 = oStoreDialog.Execute()
If iAccept1 = 1 Then
sPath = oStoreDialog.Files(0)
UIFilterName = oStoreDialog.GetCurrentFilter()
FilterIndex = IndexInArray(UIFilterName, FilterNames())
FilterName = FilterNames(FilterIndex,2)
Cell_Prjcd = oSheet11.getCellByPosition(2,249)
Dim args2(1) as new com.sun.star.beans.PropertyValue
args2(0).Name = "Hidden"
args2(0).Value = true
count = 0
oDoc2 = OpenDocument("file:///MyComputer/Project/users/mg/personal/pfa_DB.sxc",args2())
While (oDoc2.isProtected()=true)
oDoc2.dispose()
count = count + 1
oDoc2 = OpenDocument("file:///MyComputer/Project/users/mg/personal/pfa_DB.sxc",args2())
wend
oDoc2.Protect("")
oDoc2.store()
oSheets20 = oDoc2.getSheets()
oSheet21 = oSheets20.getByName("Sheet1")
oCell_Range = oSheet21.getCellRangeByPosition(1,2,1,51)
oCell_Ranges = oCell_Range.queryVisibleCells()
oCells1 = oCell_Ranges.getCells()
oCell_Enum = oCells1.CreateEnumeration()
sChoice = 0
while (oCell_Enum.hasMoreElements())
object1 = oCell_Enum.nextElement()
if (object1.getValue()=oCell_Prjcd.getValue()) then
obj_add = object1.getCellAddress()
oCell_Name = oSheet21.getCellByPosition(obj_add.Column+1,obj_add.Row)
Proj_Name = oCell_Name.STRING
oCell_Mod = oSheet21.getCellByPosition(obj_add.Column+2,obj_add.Row)
curr_mod = oCell_Mod.getValue()
if (curr_mod)=999 then
curr_mod = 0
suf = "st time"
elseif (curr_mod+1)=2 then
suf = "nd time"
elseif (curr_mod+1)=3 then
suf = "rd time"
else
suf = "th time"
endif
sChoice = MsgBox("You are going to modify PFA for this project for the "+(curr_mod+1)+suf+". Continue(Yes/No)",32+4,"Information")
endif
wend
if sChoice=6 then
oCell_Mod.setValue(curr_mod+1)
oDoc2.Unprotect("")
oDoc2.store()
oDoc2.dispose()
elseif sChoice=7 then
Svar = MsgBox("Exiting the PFA development package",64,"PFA")
oDoc2.Unprotect("")
oDoc1.dispose()
oDoc2.store()
oDoc2.dispose()
numb = 1
On numb Goto Disposing
else
Svar = MsgBox("Invalid file selected. Exiting package. Try again...")
oDoc2.Unprotect("")
oDoc1.dispose()
oDoc2.store()
oDoc2.dispose()
numb = 1
On numb Goto Disposing
endif
On Local Error Goto NOSAVING
If FilterName = "" Then
oDoc1.StoreAsUrl(sPath, NoArgs())
Else
oStoreProperties(0).Name = "FilterName"
oStoreProperties(0).Value = FilterName
oDoc1.StoreAsUrl(sPath, oStoreProperties())
End If
Else
Svar = MsgBox("Exiting the PFA development package",64,"PFA")
oDoc1.dispose()
numb = 1
On numb Goto Disposing
End If
NOSAVING:
If Err <> 0 Then
Msgbox("Document cannot be saved under '" & ConvertFromUrl(sPath) & "'", 48, GetProductName())
sPath = ""
Resume NOERROR
NOERROR:
oDoc1.dispose()
End If
Disposing:
oDoc.dispose() |
Here only call to "oDoc.dispose() " leads to the error message. |
|
| Back to top |
|
 |
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
Powered by phpBB © 2001, 2005 phpBB Group
|