Hi everyone.
I apologize if question I'll ask has already been answered, I did try search, but didn't find anything that would help me. I only know how to do simple things, and now I am stuck with this.
I have file that does certain calculations on first 2 sheets and passes some results into range of cells on Sheet3.
There I made 3 PushButtons and assigned to each macro that will sort above mentioned range of cells in certain fashion, then copy them all into clipboard. Till there everything works just fine.
Now what I need is to print that clipboard content into simple text file. Can you please tell me how ? All syntaxes I have found are:
Print #FileNo, "This is last line of text"
Write #FileNo,sValue,400
but I can't figure how to send specific range of cells to file.
Another question is: Can I somehow in macro that is run when MouseButtonPressed on one PushButton, disable all others PushButtons of that sheet? Or change their Label?
Thank you ever so much!
[Solved] Print range of cells or Clipboard content into file
[Solved] Print range of cells or Clipboard content into file
Last edited by Crls7 on Thu Aug 21, 2008 3:51 pm, edited 1 time in total.
OOo 2.4.X on Ms Windows XP
Re: Print range of cells or Clipboard content into file
http://api.openoffice.org/docs/common/r ... tDataArray
The returned array is an array of rows containing arrays of values. A1:B2 is ((A1,B1),(A2,B2))
Join is a built-in function of the Basic language, documented in the help files. I'm unshure about the open nor print statement (not used since many years), but it is documented in the help and it's the same shit as in other Basic dialects.
The returned array is an array of rows containing arrays of values. A1:B2 is ((A1,B1),(A2,B2))
... empty cells are represented by an empty string, error values are of Basic type Null.Each element of the result contains a double or a string.
Code: Select all
aRows() = myRange.getDataArray()
dim aLines(uBound(aRows())
for r = lBound(aRows()) To lBound(aRows())
aCols() = aRows(r)
aLines(r) = Join(aCols(), ";")
next r
fh= freefile()
open "/tmp/bla.txt" for append as fh
for i = 0 to uBound aLines()
sLine = aLines(i)
print sLine fh
next i
Please, edit this topic's initial post and add "[Solved]" to the subject line if your problem has been solved.
Ubuntu 18.04 with LibreOffice 6.0, latest OpenOffice and LibreOffice
Ubuntu 18.04 with LibreOffice 6.0, latest OpenOffice and LibreOffice
Re: Print range of cells or Clipboard content into file
This did not work, but I got answer at one other forum. Hoping they wouldn't mind me passing thsi info, and in case anyone else has similar program, here it is:
I was given a function made by Andrew Pitonyak
Function ConvertClipToText as String
with it I copy to clipboard and to file defined range:
I was given a function made by Andrew Pitonyak
Function ConvertClipToText as String
with it I copy to clipboard and to file defined range:
Code: Select all
args2(0).Name = "ToPoint"
args2(0).Value = "$C$6:$T$26"
dispatcher.executeDispatch(document, ".uno:GoToCell", "", 0, args2())
dispatcher.executeDispatch(document, ".uno:Copy", "", 0, Array())
rem ----------------------------------
sString = convertClipToText()
Filename = "c:/blabla.txt"
FileNo = Freefile
Open Filename For Output As #FileNo
Print #FileNo, sString
Close #FileNo
OOo 2.4.X on Ms Windows XP