OpenOffice.org Forum at OOoForum.orgThe OpenOffice.org Forum
 
 [Home]   [FAQ]   [Search]   [Memberlist]   [Usergroups]   [Register
 [Profile]   [Log in to check your private messages]   [Log in

save sheets as separate calc documents (no csv)

 
Post new topic   Reply to topic    OOoForum.org Forum Index -> OpenOffice.org Macros and API
View previous topic :: View next topic  
Author Message
patel
Power User
Power User


Joined: 14 Apr 2012
Posts: 54
Location: Italy

PostPosted: Thu May 24, 2012 5:27 am    Post subject: save sheets as separate calc documents (no csv) Reply with quote

How can I do ?
_________________
If your problem has been solved please add "[Solved]" to the beginning of your first post title (edit button).


Last edited by patel on Sat May 26, 2012 2:51 am; edited 3 times in total
Back to top
View user's profile Send private message
patel
Power User
Power User


Joined: 14 Apr 2012
Posts: 54
Location: Italy

PostPosted: Fri May 25, 2012 2:11 am    Post subject: Reply with quote

I tried with this, but it saves documents with all the sheets
Code:

    Sub saveSheets
       cFolder = "C:\...............\"
       oDoc=thiscomponent
       oSheets = oDoc.Sheets()
       aSheetNames = oSheets.getElementNames()
       For index=1 to oSheets.getCount() -1
          oSheet = oSheets.getByIndex(index)
          cNewFileName = aSheetNames(index)
          cNewFileName = Replace(cNewFileName, " ", "_")
          oController = oDoc.GetCurrentController()
          oController.SetActiveSheet(oSheet)
          oDoc.StoreToURL( ConvertToUrl( cFolder  + cNewFileName + ".ods" ), Array() )
       Next index
       'oDoc.dispose()
    End Sub

_________________
If your problem has been solved please add "[Solved]" to the beginning of your first post title (edit button).
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    OOoForum.org Forum Index -> OpenOffice.org Macros and API All times are GMT - 8 Hours
Page 1 of 1

 
Jump to:  
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