Not able to upload the stream object returned from the ToXlsxStream method of Telerik SpreadSheet processing library to Azure Blob container

1 Answer 36 Views
SpreadProcessing SpreadStreamProcessing
BINTA
Top achievements
Rank 1
BINTA asked on 15 Dec 2023, 01:32 PM

Hello,

I am trying to upload the stream object received from the 'ToXlsxStream' method of Telerik SpreadSheet processing library to Azure blob container. Unfortunately, it is saving as a blank excel file. I have data in the List object which is getting converted to xlsx stream. Not sure why the excel file is blank. Tried to save the stream to my local file explorer as well. Still, the issue persists. 

Below is the code:

 

  try
   {
Stream exportStream = exportFormat == SpreadDocumentFormat.Xlsx ? workOrderList.ToXlsxStream(columnsData, (string)options.title.ToString(), cellStyleAction: cellStyle) : workOrderList.ToCsvStream(columnsData);

Task.Factory.StartNew(() => AzureHelper.UploadReportOnCloud(exportStream,fileName, ConfigurationManager.AppSettings[Constant.REPORTATTACHMENTCONTAINER]));

}

            catch(Exception ex)
            {

            }

 

Please help me to resolve this issue.  

1 Answer, 1 is accepted

Sort by
0
Dess | Tech Support Engineer, Principal
Telerik team
answered on 18 Dec 2023, 10:35 AM

Hi, Binta,

According to the provided information, it wouldn't be easy to determine what causes the undesired behavior on your end. Could you please elaborate? How exactly the Document Processing libraries are used to generate the file? Neither RadSpreadProcessing nor RadSpreadStreamProcessing offer ToXlsxStream method. I believe that the export option of some UI control is used. If this is the case here, please let us know what is the complete scenario and setup you have on your end.

I have prepared a sample project demonstrating how to generate a workbook, populate it with dummy data and then export it to a file with the help of RadSpreadStreamProcessing. Please give it a try and see how it works on your end. Am I missing something? Could you please specify the exact steps how to reproduce the problem? Do I need to modify the project in any way to reproduce the experienced issue and investigate the precise case? Thank you in advance. 

Regards,
Dess | Tech Support Engineer, Principal
Progress Telerik

Love the Telerik and Kendo UI products and believe more people should try them? Invite a fellow developer to become a Progress customer and each of you can get a $50 Amazon gift voucher.

BINTA
Top achievements
Rank 1
commented on 28 Dec 2023, 01:05 PM

Hello Dess,

Thank you so much for the reply.  I am using the Telerik.Documents.SpreadsheetStreaming library to do the export functionality.

It has an extension method ToXlsxStream method . This converts the data to a stream object. My doubt  is can we save this stream object to azure blob container? When we save, the file is coming as blank, no data in it. 

Regards,

Binta

Peshito
Telerik team
commented on 29 Dec 2023, 05:59 AM

Hello Binta, 

Thank you for confirming the library used. There might be various reasons why the document is empty and not saved properly. It could be the extension method or something else not clear at the moment. One possible reason could be some of the Specifics the SpreadStreamProcessing library has and this is to ensure the proper release of the Stream.

To be sure the Stream is successfully released it is better to ensure the Stream disposing of (using using statement or Stream.Close/DIspose method). The using statement will make sure that the stream is released.

If this does not help, it would be best if you could reproduce the issue in a sample runnable project and share it with us. Please also feel free to modify the one Dess shared earlier. This will speed things up and point us in the right direction.

Regards,
Peshito
Progress Telerik

Tags
SpreadProcessing SpreadStreamProcessing
Asked by
BINTA
Top achievements
Rank 1
Answers by
Dess | Tech Support Engineer, Principal
Telerik team
Share this question
or