EXCEL and FNC Grid

Hi,

I know that is not possibleto export data from TTMSFNCGrid directly to Excel and the workarround is to pass data to TWebSreingGrid and then export to Excel using TWebXLSX component.

But i use this method for two years ago.

I want to know is there are a different and newer system to export to excel directly from FNCGrid.

I see that in the documentation of FNCGrid it talks about TTMSFNCGridExcelIO component to export from FNCGrid but this component is not in the palete...

Can you inform about this ?

Thanks

The TTMSFNCGridExcelIO component is included in the TMS FNC UIPack package.

Hi,

I'm work in a web project. I not see this component in the palette.

But ig i start a cvl project i can see this component...

Perhaps this component is not available for Web Development ?

Thanks

Hi,

How i say in the anterior reply, i think that TTMSFNCGridExcelIO component is not available in one Web Project.

Then i continue using TWebXLSX Component.

Whith this component i generate XL without problems in an Web Project.

But i want to modify the Cell content when i export to excel.

I need to do two kind of modifications of Cell:

1.- Modify the Value of Cell.
2.- Modify the style of Cell. For example, make Bold or set Color for the row zero...

For do this i assign my own procedure for event OnSaveCell...

But i can modify the value of the cell but i can not modify the style...

My procedure is like this:

procedure TDataGrid.EXCELSaveCell(Sender: TObject; ARow,AColumn: Integer; AContent: string; var ACell: TJSExcelJSCellRecord);
begin
if ARow=0 then
begin
ACell.cell.style.font.bold:=true; // --> ERROR (Compiler say style property not found)
console.log(ACell.cell.text); // --> Ok
ACell.cell.value:='hola'; // --> Ok
ACell.cell.font.bold:=true; // --> ERROR in runtime. Execution failed.
end;
end;

What can i do to do this ?

Thanks

ACell.cell.font is a JSON object that needs to be set if you want to override the default, so you would need to set, for example:

procedure TForm1.WebXLSX1SaveCell(Sender: TObject; ARow, AColumn: Integer;
  AContent: string; var ACell: TJSExcelJSCellRecord);
begin
  asm
    ACell.cell.font = {"size":14}; 
  end;
end;

Hi Bruno,

Thanks, but i want to continue with this theme...

With asm block i can modifify the size of the font like your example.

I can modify underline and bold property too.

But i not know how can i modify:

  • The color of font
  • The color of cell

Also, when I try to modify two properties, only the last one changes.

Form example, with this code:

    ACell.cell.font={"bold":true};
    ACell.cell.font={"underline":true};

Only change the "underline" property of font.

Surely I have to assign the properties differently but I don't know how.

Thanks in advance !

This maps on the underlying JavaScript library that is used.
More info on the cell style objects can be found here:

Hi Bruno,

Thanks, I'm moving forward with this, little by little...

With this code:

  asm
    ACell.cell.font=
      {
        bold: true,
        underline: true,

        color: { indexed: 37 }
      }
  end;

I can modify bold, color and underline properties at time without problems...

But i only can modify color property using 'indexed' method... I cannot modify color using 'rgb' method...

I can use 'indexed' method but i prefer 'rgb'...

I use this line to do this but not run:

....
color:{ rgb: "FFFFAA00" }
....

¿?

Another problem is that i can not modify Fill properties (either I don't do it well or I don't know how to do it)...

I use this code to modify the color of fill of cell:

asm
ACell.cell.fill=
{
bgcolor: { indexed: 37 }
}
end

But the color of cell is not modified and when open excel file raise an error of style.

How can i do ?

Thanks

We are not the authors of the underlying xlsx-js library, so not experts in this matter but you can find more information here:

Hi Bruno,

It seems that any library of the external js component that use the component of tms need to be updated...

The way it is now is enough for me. I will wait for future updates to see if the problem is solved.

Thanks