Pergunte aqui

Perfil de jobzombi - atividade

2020-09-03 11:39:16 +0200 Medalha recebida  Resposta legal (fonte)
2018-01-23 22:53:54 +0200 Medalha recebida  Pergunta notável (fonte)
2018-01-23 22:53:54 +0200 Medalha recebida  Pergunta popular (fonte)
2018-01-23 22:53:54 +0200 Medalha recebida  Pergunta famosa (fonte)
2016-03-07 01:53:25 +0200 Medalha recebida  Pergunta famosa (fonte)
2016-03-07 01:53:25 +0200 Medalha recebida  Pergunta notável (fonte)
2016-03-07 01:53:25 +0200 Medalha recebida  Pergunta popular (fonte)
2016-03-05 18:43:04 +0200 Marcada como a melhor resposta I'm trying to convert a spreadsheet to csv semi-colon delimited

I can -convert-to it to csv, but I need semicolon delimited since the data may have commas already. I know unoconv can be used, but my version of libre office 4 does not seem to come with that and I want to use, I may only use, something that comes native to the package. I know the following command for regular conversion:

--convert-to output_file_extension[:output_filter_name] [--outdir output_dir] files

being that it was forked from openoffice and it is opensource, I assumed that the -convert-to command must use some version of unoconv, so I wonder if I can somehow use that program's option for choosing a delimiter:

-e FilterOptions=59,34,0,1,1/5/2/1/3/1/4/1

with LO's convert-to command?

2016-01-23 19:14:35 +0200 Medalha recebida  Pergunta famosa (fonte)
2015-10-22 22:41:50 +0200 Medalha recebida  Pergunta famosa (fonte)
2015-10-22 22:41:50 +0200 Medalha recebida  Pergunta notável (fonte)
2015-08-27 10:45:08 +0200 Medalha recebida  Pergunta famosa (fonte)
2015-08-27 10:45:08 +0200 Medalha recebida  Pergunta notável (fonte)
2015-08-27 10:45:08 +0200 Medalha recebida  Pergunta popular (fonte)
2015-08-12 17:47:07 +0200 Medalha recebida  Pergunta famosa (fonte)
2015-08-12 17:47:07 +0200 Medalha recebida  Pergunta notável (fonte)
2015-08-12 17:47:07 +0200 Medalha recebida  Pergunta popular (fonte)
2015-07-13 16:20:26 +0200 Medalha recebida  Pajé (fonte)
2015-07-13 16:20:26 +0200 Medalha recebida  Professor (fonte)
2015-06-08 22:40:12 +0200 Medalha recebida  Pergunta notável (fonte)
2015-06-08 22:40:12 +0200 Medalha recebida  Pergunta popular (fonte)
2015-05-18 15:13:54 +0200 Resposta comentada Can I manipulate LO Calc from a Java app?

so cell B4 has a formula as ="12."&B2&".38.110" which pulls the octet from B4 that was supplied to the spreadsheet using the Java app. I can use the Apache POI to write set the values of cells B4-B256, but one, that would be a lot of typing and two, a larger JAR (or separate one) to write.

2015-05-18 15:10:32 +0200 Resposta comentada Can I manipulate LO Calc from a Java app?

I know macros can be in Java. Is this for a macro? What I am looking to do is have an app that users input some data, the app uses the Apache POI to pull data from other sources and then plugs them into a calc workbook for the user to see. There are plenty of complex ways of doing it, but if there is an easier way I'll take it.

To add some extra info, the data is a site id which the java app resolve some IP info and then plugs it into a list of 200+ IPs for the site;eg,second octet is 186

2015-05-18 11:25:43 +0200 Perguntou Can I manipulate LO Calc from a Java app?

In some powershell scripts I have written, I can create an object of Excel.Application and set it to visible, then change some cell values after opening a workbook. Can I do the same in LO Calc, via Java? I'm hoping there is an API that does just this, but I have been unable to find anything. What I have been doing now, which is not elegant, is that I use a macro that runs on opening a file. Java copies something like "123;456;789;234;567" to the clipboard and when the calc file opens the macro splits this data and pastes it where I needs it to go; again not elegant. Since the workbook is protected I left specific cells unlocked to allow for this data manipulation and the cutting and pasting changes cell formatting too, so I had to account for that in the macro. The powershell code to manipulate the data in excel is much shorter than the macro for calc and works 100% of the time, the issue with my macro is that it depends on the clipboard and LO Calc opens not as quickly as excel, so if the user copies ANYTHING before the macro pulls the essential data, it fails to run properly. As such I don't want to depend on the clipboard and I want to minimize human error.

2015-04-20 10:06:54 +0200 Perguntou Can I use the -convert-to, or is there any other way, to convert a worksheet in an xls into csv

Currently, the -convert-to parameter can be used to convert an xls into a csv file, but it can only do so with the front worksheet. I have come to need the converting of a specific worksheet in a workbook. Can this be done with the CLI parameters, or is there another way to do so?

Currently I have excel and LO installed, so for such needs I run a vbs script that opens a hidden session of excel, switches to the appropriate worksheet and then saves it as a csv file with semicolon delimiters.

If LO does not have a parameter for that, is there a way to do what I currently do with excel but with LO Calc?

This is the VBS I use:

Const xlCSV = 6

Set objExcel = CreateObject("Excel.Application")


objExcel.DisplayAlerts = FALSE
objExcel.Visible = FALSE

Set objExcelWorkbook = objExcel.ActiveWorkbook

objExcelWorkbook.Worksheets("Sheet Name").Activate

objExcelWorkbook.SaveAs "destination.csv", xlCSV, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1


I am not sure how to even create an object that opens LO Calc.

2015-04-20 09:59:00 +0200 Medalha recebida  Pergunta famosa (fonte)
2015-02-24 09:59:34 +0200 Resposta comentada Can't open via command prompt on Win7

Sorry I failed to point out that it is properly set in PATH, also I tried using the full pathname. This is why the application does actually load, but subsequently crashes. The -view parameter is used to open the file as read-only, by creating a temp copy of the file that is opened instead (in essence it is not a real read-only file, but that is LO's way of doing it). All files seem to open up fine using that parameter & I use it often, but I have one file that requires users to be able to edit

2015-02-24 09:59:34 +0200 Medalha recebida  Palpiteiro
2015-02-24 09:32:39 +0200 Medalha recebida  Pergunta popular (fonte)
2015-02-23 08:07:39 +0200 Perguntou Can't open via command prompt on Win7

I'm running:

soffice "filename.ods or .xls"

I'm also including several parameters, like -o or -nologo, to see what works, but none do. With -view, it opens fine, but I don't want it read-only, I want to users to be able to edit it. I also tried using scalc.exe and it just loads and then crashes. When I try opening calc again it goes to the recovery prompt.

2014-12-25 10:28:10 +0200 Pergunta comentada Is there some way to verify installed filters? convert to CLI command is not working.

So I installed the older version(s) and I still can't do it. All I did was uninstall the old program. It left behind a libreoffice 4 folder in program files, which I deleted. I assume when I reinstall, python and all the other dependencies should have been reinstalled, but it still does not want to cooperate. Do I need to reboot? This sucks, because a lot of which I have been working on for my company's MsO to LO switch depended on converting several files to CSV.

2014-12-25 03:38:34 +0200 Perguntou Is there some way to verify installed filters? convert to CLI command is not working.

I had LibreOffice 4.3.1, but it started giving me an issue where I could not open macros for editing without it crashing on me. I uninstalled it and installed I can edit macros again, but I can no longer use the following command:

"C:\Program Files (x86)\LibreOffice 4\program\scalc.exe" -convert-to csv:"Text - txt - csv (StarCalc)":59,34,0,1,1/1 "some path\Test.xls" -outdir "some path"

Per the help prompt that comes up on occasion:

--convert-to output_file_extension[:output_filter_name[:output_filter_options]] [--outdir ouput_dir] files

It used to work, but now it does not. The help dialog that comes up still says the same thing, but when I run the command, it just opens a blank spreadsheet. Nothing is converted. When I save from Calc itself, I can select to edit filter settings through the Save As GUI, so...I assume the filter is there. I just want to check to make sure.

2014-12-23 04:04:08 +0200 Pergunta comentada Run a window cmd ping from a macro

This helped though. Thanks.

2014-12-23 04:03:56 +0200 Pergunta comentada Run a window cmd ping from a macro

The help site has some examples, but they are exe or bat files.

2014-12-22 04:30:04 +0200 Medalha recebida  Entusiasta
2014-12-21 13:53:26 +0200 Medalha recebida  Pergunta notável (fonte)
2014-12-21 10:49:06 +0200 Perguntou Run a window cmd ping from a macro

I know we have the Shell the command:

Shell (Pathname As String[, Windowstyle As Integer][, Param As String][, bSync])

But I don't want to use a .bat file, but just do a ping. In excel I could do:

command = "ping"
Shell(command, vbNormalFocus)

But I cannot seem to get it to work in libreoffice. I've review the openoffice sites, here and some documentations on basic, but I cannot seem to find out how. I keep getting syntax errors.

2014-12-21 09:01:33 +0200 Resposta comentada How can I select the value of an active cell in calc

I took a look at Pitonyak's macro guide, and while I was able to figure out getting the address of the active cell, I still can't figure out getting the value of the cell and saving it to a variable, so I can then run a command with it.

2014-12-14 05:05:10 +0200 Medalha recebida  Pergunta popular (fonte)
2014-12-14 04:52:02 +0200 Resposta comentada How can I select the value of an active cell in calc

I know javascript and python is supported too as macros, what else can be used?

2014-12-13 11:36:27 +0200 Perguntou How can I select the value of an active cell in calc

In VisualB it is ActiveCell.Value, but I cannot seem to find it in LOBasic.

This is my VB script:

command = ActiveCell.Value
If Left(command, 3) = "10." Then
command = "ping " + command
End If
If Left(command, 4) = "ping" Then
vbReturn = Shell(command, vbNormalFocus)
vbReturn = MsgBox("Select Ping Command or IP Address" & vbCrLf & "Then Press: Execute Ping Command", vbOKOnly)
Exit Sub
End If

I'd greatly appreciate any help I can get. I'm assuming the vbReturn and vbOKOnly may also be different.

2014-12-13 11:29:45 +0200 Perguntou Can one pass a variable from powershell or cmd to an ods/xls file?

In excel I do the following command in Powershell:

$a = New-Object -ComObject Excel.Application
$a.Visible = $True
$b = $a.Workbooks.Add("\\networkdrive\IPAddresses.xls")
$c = $b.Worksheets.Item(1)
$c.Cells.Item(3,3) = "$Oct"
$c.Cells.Item(2,3) = "$Loc"

The the xls file has a formula for the cells that takes the octet data given in $Oct and adds it to list IP address for a given location ($Loc) Works fine for excel, but I wish to do the same with SCalc. Does this:

cell 3,3 is D3, so if $oct equals 6.123, and if cell E6 has ="10.12"&D3&".150" I get

there is no object named scalc.application to use in powershell, that I know of, so the only way I have somewhat come up with doing this is by converting it to and xml file and finding the line for the cell in question, replacing it, saving a temp copy elsewhere and opening that. The issue is that well, I'll end up having to create one xml file that will be used to save over 1000 temp xml files of which then I cannot delete, since once the file opens, I cannot delete it while in use, and after running the script, there is now way to keep track of the xml file name to delete once it closes, the script in question will loop back to the beginning to await another command, so it and the xml file could be used at the same time, rather than have the powershell script wait for Scalc to close, which then I could have it delete the file, but will leave it unusable for the time being used.

2014-11-03 00:13:21 +0200 Medalha recebida  Pergunta notável (fonte)
2014-11-02 22:01:54 +0200 Respondeu uma pergunta I'm trying to convert a spreadsheet to csv semi-colon delimited

I played around withe CLI command and ended up answering this question by answering another person's question...

2014-11-02 08:12:18 +0200 Medalha recebida  Editor (fonte)
2014-11-02 08:12:18 +0200 Resposta editada Is it possible to specify CSV filter options on the command line?

You can add options. I'm using LO and the convert-to has the following syntax:

--convert-to output_file_extension[:output_filter_name[:output_filter_options]] [--outdir ouput_dir] files

In the case of converting to csv from xls, like I had to, you would do:

-convert-to csv:"Text - text - csv (StarCalc)":#,#,#,#,# [-outdir ouput_dir] files

The option syntax is found here:

The filter option has 5 tokens separated by commas. You HAVE to use all 5 or none. I know semi-colons are 59, so I tried just:

...(StarCalc)":59 -outdir...

and that did not work. If you are not sure what to use for the fifth token, just put a "1", no need for "1/1" or anything like that. I used 59,34,0,1,1 and that worked just fine.

So for me:

"C:\Program Files (x86)\LibreOffice 4\program\scalc.exe" -convert-to csv:"Text - txt - csv (StarCalc)":59,34,0,1,1 -outdir "C:\somepath\" "C:\anotherpath\File.xls"