=====Enregistrer toutes les feuilles d'un tableau en plusieurs fichier .csv===== Sub Main document = ThisComponent ' Use the global string tools library to generate a base filename for each CSV ' based on the current prefixless filename GlobalScope.BasicLibraries.loadLibrary("Tools") BaseFilename = Tools.Strings.GetFileNameWithoutExtension(document.getURL(), "/") ' Work out number of sheets for looping over them later. Sheets = document.Sheets NumSheets = Sheets.Count - 1 ' Set up a propval object to store the filter properties Dim Propval(1) as New com.sun.star.beans.PropertyValue Propval(0).Name = "FilterName" Propval(0).Value = "Text - txt - csv (StarCalc)" Propval(1).Name = "FilterOptions" Propval(1).Value ="44,34,76,1,1" 'ASCII 44 = , 34 = " For I = 0 to NumSheets ' For each sheet, assemble a filename and save using the filter SheetName = Sheets(I).Name document.getCurrentController.setActiveSheet(Sheets(I)) Filename = Tools.Strings.DirectoryNameoutofPath(ThisComponent.getURL(),"/") + "/" + BaseFilename + "-" + SheetName + ".csv" FileURL = convertToURL(Filename) document.StoreToURL(FileURL, Propval()) Next I End Sub Exporting all Libreoffice worksheets as CSV : [[http://www.jpstacey.info/blog/2014-09-12/exporting-all-libreoffice-worksheets-csv|Exporting all Libreoffice worksheets as CSV _ J-P Stacey]] {{ :prog:libreoffice:macros:exporting_all_libreoffice_worksheets_as_csv_j-p_stacey_2020-04-28_9_13_36_pm_.html |Archive du 12/09/2014 le 28/04/2020}} Filter Options : [[https://wiki.openoffice.org/wiki/Documentation/DevGuide/Spreadsheets/Filter_Options|Filter Options — Apache OpenOffice Wiki]] {{ :prog:libreoffice:macros:filter_options_-_apache_openoffice_wiki_2020-04-28_9_13_36_pm_.html |Archive du 16/08/2018 le 28/04/2020}} XStorable Interface Reference : [[http://api.libreoffice.org/docs/idl/ref/interfacecom_1_1sun_1_1star_1_1frame_1_1XStorable.html|LibreOffice_ XStorable Interface Reference]] {{ :prog:libreoffice:macros:libreoffice_xstorable_interface_reference_2020-04-28_9_13_36_pm_.html |Archive le 28/04/2020}}