ReoGrid Forum

Fast and powerful .NET Spreadsheet Component

You are not logged in.

Announcement

This forum has been archived and no longer accepts new user registrations. Please report your questions, problems, and feedback to the issue page of ReoGrid on GitHub. Thank you for your cooperation.

https://github.com/unvell/ReoGrid/issues

#1 2014-08-21 02:19:21

asparatu
Member
Registered: 2014-08-20
Posts: 196

How to add text to cell

I seen that you can add text to a cell by using the object(0,0) = "Text" or object("A1") = "Text", but i seen a object.cells("A1").Display. It say you Get or set the cells display text but when i take object.cells("A1").Display = "Text", its say it readonly.

Offline

#2 2014-08-21 02:27:42

Jingwood
Moderator
From: jing at reogrid.net
Registered: 2014-06-03
Posts: 615

Re: How to add text to cell

Display text cannot be changed, it is the processed result from the data by cell format. Please try to get the display what you want by changing data and cell format.

Offline

#3 2014-08-21 02:31:03

asparatu
Member
Registered: 2014-08-20
Posts: 196

Re: How to add text to cell

Ok, How would you do that? would just be by using the object("A1") = "Text"?

Offline

#4 2014-08-21 02:41:57

Jingwood
Moderator
From: jing at reogrid.net
Registered: 2014-06-03
Posts: 615

Re: How to add text to cell

Yes. Three methods to change data:

grid("A1") = "Text"
grid.SetCellData("A1", "Text")
grid.Cells("A1").Data = "Text"

Number will be put on right alignment but it could be changed, for example:

' text
grid("A1") = "text"

' number type (right alignment)
grid("A2") = 10

' change number to string
grid.SetRangeDataFormat(New ReoGridRange("A3"), _
                        DataFormat.CellDataFormatFlag.Text, Nothing)
grid("A3") = 20

' keep number type but put on left
grid.Cells("A4").Data = 30
grid.Cells("A4").Style.HAlign = ReoGridHorAlign.Left

Offline

#5 2014-08-21 04:02:40

asparatu
Member
Registered: 2014-08-20
Posts: 196

Re: How to add text to cell

Ok.. I see.. thank you again..

I have notice something else, When you to the cell alignment to middle center, i notice that text or numbers on the left get cut off a little.

Text Cutting Off

Last edited by asparatu (2014-08-21 04:06:17)

Offline

#6 2014-08-23 02:12:51

Jingwood
Moderator
From: jing at reogrid.net
Registered: 2014-06-03
Posts: 615

Re: How to add text to cell

OK I will check it. And the comment says 'Get or set the cell display', this is a mistake and will be fixed in next version. Thanks for pointing out.

Offline

#7 2014-08-23 08:22:32

asparatu
Member
Registered: 2014-08-20
Posts: 196

Re: How to add text to cell

You are welcome smile

Offline

Board footer

Powered by FluxBB