[Solved] Reading and writing to a cell

Discuss the spreadsheet application
Post Reply
Fraz627
Posts: 22
Joined: Sat Jun 17, 2017 8:31 am

[Solved] Reading and writing to a cell

Post by Fraz627 »

I know this sounds very basic but I'm new at Open Office

how does this translate to Open Office

Mrow=3 ' row number
mcol =4 "column number
mystring="testing"

cells(mrow,mcol)=mystring

also

mystring=cells(mrow,mcol).value
Last edited by Hagar Delest on Wed Jun 21, 2017 9:41 pm, edited 1 time in total.
Reason: tagged [Solved].
Open Office 4.1 on Windows 10
FJCC
Moderator
Posts: 9274
Joined: Sat Nov 08, 2008 8:08 pm
Location: Colorado, USA

Re: Reading and writing to a cell

Post by FJCC »

Code: Select all

oSheet = ThisComponent.CurrentController.ActiveSheet
Mrow=3 ' row number
mcol =4 'column number
mystring="testing"
oCell = oSheet.getCellByPosition(mcol,Mrow)
'cells(mrow,mcol)=mystring
oCell.String = mystring

mystring2 = oCell.String
'mystring=cells(mrow,mcol).value
Rows and columns are indexed from zero, so that code puts text in E4 of the active sheet. Note that the String and the Value of a cell are different things. The String is the text you see, the Value is the underlying numeric value.
OpenOffice 4.1 on Windows 10 and Linux Mint
If your question is answered, please go to your first post, select the Edit button, and add [Solved] to the beginning of the title.
Fraz627
Posts: 22
Joined: Sat Jun 17, 2017 8:31 am

Re: Reading and writing to a cell

Post by Fraz627 »

Thanks, I'm just learning Star basic.
Open Office 4.1 on Windows 10
Post Reply