Hello
Is it possible to read just one named range in Virtual Mode?
Also named range can have a scope EG Workbook and Sheet.
Ca I get this information from somewhere?
Mike
Hi,
Names are read when the workbook is being read, but currently you need to do this only after you have finished opening the file in virtual mode.
After the call to Xls.Open, you can retrieve the named ranges with code like this:
for i := 1 to Xls.NamedRangeCount do
begin
Name := Xls.GetNamedRange(i);
ShowMessage(Name.Name);
DoSomething(Name.NameSheetIndex);
end;
Where Name,NameSheetIndex gives you the scope (0 means a global scope, while a number >= 1 means a name that is defined in an specific a sheet). Name range support in FlexCel is complete, including even names that don't reference to a cell, like if you define a name to be "=a1+1"
Just in case I've modified it here so you could read the names now in virtual mode even before the file has been loaded, but I wonder if that would make a difference to you.
Regards,
Adrian.
Just in case I've modified it here so you could read the names now
in virtual mode even before the file has been loaded, but I wonder if
that would make a difference to you.
Your components are great we we need more examples
Mike
>Yes it would.
I'll upload a version with this ability for tomorrow. It will be available in the "beta" downloads below the stable download.
>Your components are great we we need more examples
Thanks :) There are more examples coming (in .NET we have over 58 examples, most should be coming to VCL), and we will also be reviewing the docs, but at this time FlexCel VCL is still a work in progress, and we are focusing more in the actual functionality than in the docs. For example, 5.2 a full pdf and rendering engine that will be able to export any xls/x file to pdf/html or images should be coming in a couple of months.
Regards,
Adrian.
The new beta is uploaded. Now you can use the OnVirtualCellStartReading event, where the sender in that event is a TXlsFile, to get the names.
Something like:
procedure CellReader.VirtualCellStartReading(const sender: TObject; const e: TVirtualCellStartReadingEventArgs);
var
i: Int32;
xls: TXlsFile;
begin
xls := Sender as TXlsFile;
for i := 1 to Xls.NamedRangeCount do
begin
Name := Xls.GetNamedRange(i);
ShowMessage(Name.Name);
DoSomething(Name.NameSheetIndex);
end;
end;
Regards,
Adrian.