You are not logged in.
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.
Pages: 1
Topic closed
I can setup the range format using SetRangeDataFormat(...), see below (1)
Question: How can I get the rangeFormat (or Cell format) and compare it to a predefined format, see below (2)?
Thanks a lot
And, again, very impressive control
Damien
-------------------------------------
1. Setup the format
grid.CurrentWorksheet.SetRangeDataFormat(grid.CurrentWorksheet.SelectionRange, CellDataFormatFlag.Number, getFormatNumber());
private NumberDataFormatter.NumberFormatArgs getFormatNumber()
{
return new NumberDataFormatter.NumberFormatArgs()
{
NegativeStyle = NumberDataFormatter.NumberNegativeStyle.Minus,
UseSeparator = false,
};
}
-------------------------------------
2. I would like to have something like:
if( Cell.GetDataFormat() == MyFormat())
.......
with MyFormat() is defined in getFormatNumber() + CellDataFormatFlag.Number
So
1. How to construct MyFormat()
2. How to get the format from a cell (not the full style)
Offline
For retrieving the cell data format and format arguments, you could access via the instance of cell:
using unvell.ReoGrid;
using unvell.ReoGrid.DataFormat;
...
var sheet = grid.CurrentWorksheet;
var cell = sheet.Cells["A1"];
if (cell.DataFormat == CellDataFormatFlag.Percent)
{
var fmtArg = (NumberDataFormatter)cell.DataFormatArgs;
// ...
}
In addition, if you want to create a customize data format, please refer to here: https://reogrid.net/document/custom-data-formatter/
Regards, Jing
Last edited by Jingwood (2015-09-20 12:34:19)
Offline
Pages: 1
Topic closed