[Solved] How to create new SS with only one sheet

Discuss the spreadsheet application
Post Reply
Herb40
Posts: 134
Joined: Thu May 08, 2014 3:35 am

[Solved] How to create new SS with only one sheet

Post by Herb40 »

When I create a new SS with code such as shown below, Calc creates a SS with 3 sheets. Is there some property value or filter I can use to have Calc create only 1 sheet? Thanks for your help.

Code: Select all

	Dim nDoc as Object
	Dim nPV(1) as New com.sun.star.beans.PropertyValue
	nPV(0).Name = "Hidden"
	nPV(0).Value = True
	nPV(1).Name = "ReadOnly"
	nPV(1).Value = False
	sURL = "private:factory/scalc"
	nDoc = StarDesktop.LoadComponentFromUrl(sURL, "_blank", 0, nPV())
Tagged as Solved as per the last post by the OP. floris v, moderator
OpenOffice 4.1.3 on Windows 10
User avatar
Lupp
Volunteer
Posts: 3553
Joined: Sat May 31, 2014 7:05 pm
Location: München, Germany

Re: How to create new SS with only one sheet

Post by Lupp »

The default template should be used here.
Create a spreadsheet document with only one sheet, save it as a template and make it your default template for spreadsheets.
You can also name (give by URL) a template (with only one sheet) explicitly for your LoadComponentFromURL call. (This instead of the as-if URL).

(I did not test this, and I didn't do it for a long time in AOO.)

(Editing: Just tested the second option again. It will create an 'Untitled...' spreadsheet document if called for a .ots file as expected.)
On Windows 10: LibreOffice 24.2 (new numbering) and older versions, PortableOpenOffice 4.1.7 and older, StarOffice 5.2
---
Lupp from München
Herb40
Posts: 134
Joined: Thu May 08, 2014 3:35 am

Re: How to create new SS with only one sheet

Post by Herb40 »

Thanks for your help, Lupp.

I tried the second option, but had to add the Property "AsTemplate" with a value of True in order to make it work.
OpenOffice 4.1.3 on Windows 10
Post Reply