Jump to content


able

Member Since 23 May 2009
Offline Last Active Jun 07 2009 10:38 PM
-----

Topics I've Started

TNXGrid, SaveToExcel procedure

04 June 2009 - 10:51 AM

Hi! I've wrote SaveToExcel procedure.

CODE
procedure TMForm.SaveToExcel(RGrid: TNxGrid);
var
XLApp: Variant;
i, n: integer;
begin
XLApp:= CreateOleObject('Excel.Application');

XLApp.DisplayAlerts := false;

XLApp.Workbooks.Add;
XLApp.Visible:=true;

XLApp.Workbooks[1].WorkSheets[1].Name:='NXGrid Export';

XLApp.WorkBooks[1].WorkSheets[1].Rows[1].Font.Bold := true;

for i:=0 to RGrid.Columns.Count-1 do
XLApp.WorkBooks[1].WorkSheets[1].Cells[1,i+1] := RGrid.Columns[i].Header.Caption;

for i:=0 to RGrid.RowCount-1 do
  for n:=0 to RGrid.Columns.Count-1 do
    XLApp.WorkBooks[1].WorkSheets[1].Cells[i+2,n+1] := RGrid.Cell[n,i].AsString;
end;

Caption and value of a cell

25 May 2009 - 01:14 PM

Hello!

I need help: to put in a cell: $value1 ($value2).
To do this, well suited htmlcolumn, at the same time you can make up the correct values.

But I need to make a numeric sort by the $value.

Ie fact that the cells have two options: caption and value.
Caption is displaying on the screen to the user, and the value is the sorting, calculating footer, etc.

Can I do it be means of NXGrid?

P.S. Sorry for my English, I'm from Russia.