| View previous topic :: View next topic |
| Author |
Message |
rmcintire Newbie

Joined: 29 Mar 2007 Posts: 2
|
Posted: Thu Mar 29, 2007 1:30 pm Post subject: Help for Excel User - Default Sheet Template |
|
|
I have searched all over but have not been able to find the answer to my specific question. I'm hoping someone can help.
I have successfully created a default template for my spreadsheet using the workbook template I used in Excel. Now I'm trying to convert my sheet template (worksheet in Excel) so that when I do Insert -> Sheet, it inserts a new worksheet in the correct format (I have a custom header and footer as well as conditional formatting for both the spreadsheet and sheet). Currently when I insert, it's a blank sheet (the OO Calc default).
Any suggestions? Thanks in advance for your input. |
|
| Back to top |
|
 |
noranthon Super User

Joined: 07 Jul 2005 Posts: 3323
|
Posted: Thu Mar 29, 2007 9:01 pm Post subject: |
|
|
First, you need to save the document as a template - File >Templates >Save. Then you need to set it as the default template - File >Templates >Organise. _________________ search forum by month |
|
| Back to top |
|
 |
rmcintire Newbie

Joined: 29 Mar 2007 Posts: 2
|
Posted: Fri Mar 30, 2007 7:09 am Post subject: |
|
|
Thanks for the reply, but it doesn't fix my situation.
In Excel, you can specify both a Book and Sheet template and place them in the XLSTART directory. The Book template becomes your default spreadsheet and when you insert new worksheets, the Sheet template is used.
I already have my Spreadsheet template setup and set as the default. It looks and works fine. What I need now is to specify the default Sheet template so that when I insert a new sheet, it uses the template (rather than having to insert a sheet from a file).
Thanks again for any suggestions. |
|
| Back to top |
|
 |
Villeroy Super User


Joined: 04 Oct 2004 Posts: 7649 Location: Germany
|
Posted: Fri Mar 30, 2007 9:08 am Post subject: |
|
|
Very simple macro which copies a (hidden) sheet within this workbook.
Adjust constant "Template" to the sheet's name.
| Code: |
sub copyTemplate()
'calls: getUniqueName
Const SourceSheet$ = "Template"
dim oSheets, sName
oSheets = thisComponent.getSheets()
sName = getUniqueName(oSheets,SourceSheet)
' copy sheet named SourceSheet as sName to first position 0:
oSheets.copyByName(SourceSheet,sName,0)
end sub
Function getUniqueName(oContainer,sName$)
Dim i%,sNew$
sNew = sName
Do while oContainer.hasByName(sNew)
i = i +1
sNew = sName &"_"& i
loop
getUniqueName = sNew
End Function
|
_________________ XUbuntu 9.04, OOo 3.1.1(Sun), Sun Java 1.5.0_06 |
|
| Back to top |
|
 |
|