Recent

Author Topic: how to export to memorystream  (Read 650 times)

Packs

  • Sr. Member
  • ****
  • Posts: 364
how to export to memorystream
« on: November 03, 2024, 12:56:59 pm »
how to export to memorystream .


silvercoder70

  • Jr. Member
  • **
  • Posts: 88
    • Tim Coates
Re: how to export to memorystream
« Reply #1 on: November 03, 2024, 01:11:07 pm »
export what and from where...?

otherwise ...

there are WriteToStream() methods in fpspreadsheet.pas
« Last Edit: November 03, 2024, 01:16:47 pm by silvercoder70 »
Explore the beauty of modern Pascal programming with Delphi & Free Pascal - https://www.youtube.com/@silvercoder70

Packs

  • Sr. Member
  • ****
  • Posts: 364
Re: how to export to memorystream
« Reply #2 on: November 03, 2024, 01:20:24 pm »
I want to dataset to excel stream

wp

  • Hero Member
  • *****
  • Posts: 12456
Re: how to export to memorystream
« Reply #3 on: November 03, 2024, 02:11:07 pm »
Sorry, I don't understand. Maybe you first write your question in your own language and then google-translate it to English.

Packs

  • Sr. Member
  • ****
  • Posts: 364
Re: how to export to memorystream
« Reply #4 on: November 03, 2024, 02:20:52 pm »
Fpspeadsheet is exporting to excel file. I want it in stream format then I will convert to base64 and store in db

wp

  • Hero Member
  • *****
  • Posts: 12456
Re: how to export to memorystream
« Reply #5 on: November 03, 2024, 02:28:38 pm »
Fpspeadsheet is exporting to excel file. I want it in stream format then I will convert to base64 and store in db
Code: Pascal  [Select][+][-]
  1.   // Untested, maybe some typos here and there...
  2. uses
  3.   fpSpreadsheet, fpsTypes, xlsxOOML;
  4. var
  5.   stream: TMemoryStream;
  6.   workbook: TsWorkbook;
  7.   worksheet: TsWorksheet;
  8. begin
  9.   workbook := TsWorkbook.Create;
  10.   try
  11.     worksheet := workbook.AddWorksheet('Test');
  12.     worksheet.WriteText(0, 0, 'abc');
  13.     worksheet.WriteNumber(1, 0, 3.14);
  14.     stream := TMemoryStream.Create;
  15.     try
  16.       workbook.WriteToStream(stream, sfOOXML);
  17.       // --- do something with the stream...
  18.     finally
  19.       stream.Free;
  20.     end;
  21.   finally
  22.     workbook.Free;
  23.   end;
  24. end;

Packs

  • Sr. Member
  • ****
  • Posts: 364
Re: how to export to memorystream
« Reply #6 on: November 03, 2024, 07:19:09 pm »
Thank you 🙏. I will check

Packs

  • Sr. Member
  • ****
  • Posts: 364
Re: how to export to memorystream
« Reply #7 on: November 04, 2024, 10:54:37 am »
Thank you 🙏. It is working

Packs

  • Sr. Member
  • ****
  • Posts: 364
Re: how to export to memorystream
« Reply #8 on: November 04, 2024, 07:30:15 pm »

Code: Pascal  [Select][+][-]
  1.      
  2. FPSExport.FileName:='xyz.xlsx';
  3.       FPSExport.Dataset := vt_column;
  4.       FPSExport.MultipleSheets:= false ;
  5.       FPSExport.FormatSettings.HeaderRow:= true;
  6.       FPSExport.Execute;
  7.       FPSExport.WriteExportFile;
  8.  

FPSExport to memorystream option not found in FPSExport  component.
how I can implement export to memory stream 

 

TinyPortal © 2005-2018