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

Creating a macro - Writing a Script - Using the API

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

Postby namar » Thu Jul 17, 2008 7:07 pm

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

Re: clarification

Postby Villeroy » Thu Jul 17, 2008 7:16 pm

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

Code: Select all   Expand viewCollapse view
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
User avatar
Villeroy
Volunteer
 
Posts: 29721
Joined: Mon Oct 08, 2007 1:35 am
Location: Germany

Re: clarification

Postby namar » Thu Jul 17, 2008 9:10 pm

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

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

Postby Villeroy » Thu Jul 17, 2008 9:50 pm

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
User avatar
Villeroy
Volunteer
 
Posts: 29721
Joined: Mon Oct 08, 2007 1:35 am
Location: Germany


Return to Macros and UNO API

Who is online

Users browsing this forum: flyer48, JeJe, Zizi64 and 10 guests