Re: [libreoffice-users] Re: Batch for extracting lines into new files in CALC

2012-01-19 Thread Jay Lozier

Patrick,

On 01/19/2012 06:32 AM, tk5ep wrote:

Hi All,

Thanks for the different answers, but even if there are good ideas, they are
all more demanding than doing all the work by hand in Calc.

I could filter, copy , paste the result in a new sheet and save it... 4 or 5
clicks to be repeated 124 times.

I was looking for a way to do that with a batch or an automated process. If
i have to do a more complex process 124 times, there is no gain

One other option is to use a macro to do this.


Thanks anyway,
Patrick

--
View this message in context: 
http://nabble.documentfoundation.org/Batch-for-extracting-lines-into-new-files-in-CALC-tp323p3672075.html
Sent from the Users mailing list archive at Nabble.com.




--
Jay Lozier
jsloz...@gmail.com


--
For unsubscribe instructions e-mail to: users+h...@global.libreoffice.org
Problems? http://www.libreoffice.org/get-help/mailing-lists/how-to-unsubscribe/
Posting guidelines + more: http://wiki.documentfoundation.org/Netiquette
List archive: http://listarchives.libreoffice.org/global/users/
All messages sent to this list will be publicly archived and cannot be deleted



Re: Re: [libreoffice-users] Re: Batch for extracting lines into new files in CALC

2012-01-19 Thread SARoets

Unsubscribe me please!

The unsubscribe procedure does not work!

--
For unsubscribe instructions e-mail to: users+h...@global.libreoffice.org
Problems? http://www.libreoffice.org/get-help/mailing-lists/how-to-unsubscribe/
Posting guidelines + more: http://wiki.documentfoundation.org/Netiquette
List archive: http://listarchives.libreoffice.org/global/users/
All messages sent to this list will be publicly archived and cannot be deleted



Re: [libreoffice-users] Re: Batch for extracting lines into new files in CALC

2012-01-19 Thread Sigrid Carrera
Hi, 

did  you actually read the instructions? I'm talking about this ones
here:
http://www.libreoffice.org/get-help/mailing-lists/how-to-unsubscribe/

Btw, this link is added to each email, so you should have seen it. 

If you did read the instructions, then why didn't you write to the
postmaster, as suggested there? No one of us users can unsubscribe you.


On Thu, 19 Jan 2012 19:43:44 +
saro...@gmail.com wrote:

 Unsubscribe me please!
 
 The unsubscribe procedure does not work!

If all your attempts to unsubscribe just don't work, then - as a last
resort - please send a message to postmas...@documentfoundation.org and
include the following information: The lists you want to be
unsubscribed from, the address you're subscribed with, and detailed
information about the problems you encountered. Please include/forward
the replies you received from the mailing list system, if you received
any.

So, please write to the postmaster and include the necessary
informations. 

Sigrid

-- 
For unsubscribe instructions e-mail to: users+h...@global.libreoffice.org
Problems? http://www.libreoffice.org/get-help/mailing-lists/how-to-unsubscribe/
Posting guidelines + more: http://wiki.documentfoundation.org/Netiquette
List archive: http://listarchives.libreoffice.org/global/users/
All messages sent to this list will be publicly archived and cannot be deleted



Re: [libreoffice-users] Re: Batch for extracting lines into new files in CALC

2012-01-18 Thread Calvin Kim
I usually convert it to .csv and extract data with PHP, but I love to 
see how to do it with Calc.

cK

--
For unsubscribe instructions e-mail to: users+h...@global.libreoffice.org
Problems? http://www.libreoffice.org/get-help/mailing-lists/how-to-unsubscribe/
Posting guidelines + more: http://wiki.documentfoundation.org/Netiquette
List archive: http://listarchives.libreoffice.org/global/users/
All messages sent to this list will be publicly archived and cannot be deleted



Re: [libreoffice-users] Re: Batch for extracting lines into new files in CALC

2012-01-18 Thread Calvin Kim


On 01/18/2012 03:08 PM, Andreas Säger wrote:

Am 18.01.2012 18:13, Andreas Säger wrote:


Connect a registered Base document to the spreadsheet. A connection to
an indexed dBase copy might be more performant.
Create a parameter query: SELECT * FROM Table WHERE Column= :p


Use the parameter query for testing if you get the wanted records for 
a given number :p.
Store the following Basic code somewhere in the global library 
container (aka My Macros).
Modify the 6 constants on top of the code. Registered name of the 
database, table name, column name, first ID to substitute, last ID to 
substitute and the target path.
The code works without further modifications but with any type of 
database such as address books, csv, spreadsheets, dBase, MySQL, 
HSQLDB, MS Access, MS servers, Oracle servers, anything connectable 
with a Base document.



Sub Import2xls
Const cDataSource = Chargen
Const cTableName = MAT
Const cColumnName =ID
Const cStartID = 405
Const cEndID = 407
Const cPath = /tmp/

Dim addr as new com.sun.star.table.CellRangeAddress
sQuery = SELECT * FROM  cTableName WHERE  cColumnName 
=

' print squery
Dim xlsprop as new com.sun.star.beans.PropertyValue
xlsprop.Name = FilterName
xlsprop.Value = MS Excel 97

for i = cStartID to cEndID
doc = 
StarDesktop.loadComponentFromURL(private:factory/scalc,_blank, 0, 
Array() )

dbx = doc.DatabaseRanges
dbx.addNewByName(Import2xls, addr)
dbr = dbx.getByName(Import2xls)
dsc() = dbr.getImportDescriptor()
for each prop in dsc()
if prop.Name = SourceType then prop.Value = 
com.sun.star.sheet.DataImportMode.SQL

if prop.Name = SourceObject then prop.Value = sQuery  i
if prop.Name = DatabaseName then prop.Value = cDataSource
next
dbr.ReferredCells.doImport(dsc())
doc.storeAsURL(convertToURL(cPath  format(i, 
String(len(cEndID),0)) .xls), Array(xlsprop))

doc.close(True)
next
End Sub





Nice. Thank you for the tip. I shall remember it for next round.
Keep the good work.

--
For unsubscribe instructions e-mail to: users+h...@global.libreoffice.org
Problems? http://www.libreoffice.org/get-help/mailing-lists/how-to-unsubscribe/
Posting guidelines + more: http://wiki.documentfoundation.org/Netiquette
List archive: http://listarchives.libreoffice.org/global/users/
All messages sent to this list will be publicly archived and cannot be deleted