[Solved] Get cell contents (value, text, formula)

Creating a macro - Writing a Script - Using the API (OpenOffice Basic, Python, BeanShell, JavaScript)
Post Reply
namar
Posts: 5
Joined: Thu Jul 17, 2008 6:58 pm

[Solved] Get cell contents (value, text, formula)

Post by namar »

Welcome beginner. Please answer all of the questions below which may provide information necessary to answer your question.
-----------------------------------------------------------------------------------------------------------
Which version of OpenOffice.org are you using?
2.2
What Operating System (version) are you using?
windows xp/2000
What is your question or comment?

Hi,
I am beginer in the office application
I have tried to ran the below mentioned script
in openoffice calc...
It's not working....
Even if I am putting any values in the cell,it alsways shows Zereo..
Could u please help me....


Sub getCellInfo
'get the first sheet of the spreadsheet doc
xSheet = ThisComponent.Sheets(0)

'Get value of Cell A1
A1_value = xSheet.getCellByPosition(0,0).value

print A1_value

End Sub
Last edited by namar on Thu Jul 17, 2008 9:19 pm, edited 1 time in total.
OOo 2.2.X on Ms Windows XP
User avatar
Villeroy
Volunteer
Posts: 31279
Joined: Mon Oct 08, 2007 1:35 am
Location: Germany

Re: clarification

Post by Villeroy »

Hi and welcome to the forum. There is a separate forum for this type of questions.

Code: Select all

Sub getCellInfo
'get the first sheet of the spreadsheet doc
xSheet = ThisComponent.Sheets(0)

'Get  Cell A1
oCell = xSheet.getCellByPosition(0,0)

'It has a numeric value, a string 2 versions of a formula and an error:
print oCell.value, oCell.string,oCell.formula, oCell.FormulaLocal, oCell.Error

End Sub
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
namar
Posts: 5
Joined: Thu Jul 17, 2008 6:58 pm

Re: clarification

Post by namar »

Thanks for this information...yes it's working now...

Meanwhile Could you please let me know the forum in which I should log these type of Queries...
I have some more doubts to be clarified....
OOo 2.2.X on Ms Windows XP
User avatar
Villeroy
Volunteer
Posts: 31279
Joined: Mon Oct 08, 2007 1:35 am
Location: Germany

Re: [Solved] Get cell contents (value, text, formula)

Post by Villeroy »

I changed location and subject of this thread.
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
Post Reply