we’re loading the excel stream and performing some operations.
var loadOptions = new LoadOptions(LoadFormat.Auto);
//Load stream from file store.
workbook = new Aspose.Cells.Workbook(excelStream, loadOptions);
workbook.Save("filename.xlsx");
the output file has no comments but notes are being retained.
@nraj,
We can get the correct results by running the following code with the latest version Aspose.Cells 23.7. Please refer to the attachment (9.7 KB).
var loadOptions = new LoadOptions(LoadFormat.Auto);
//Load stream from file store.
using (FileStream excelStream = new FileStream("comment.xlsx", FileMode.Open))
{
Workbook wb = new Workbook(excelStream, loadOptions);
wb.Save("out_net.xlsx");
}
//excelStream is MemoryStream (not Filestream) in our case as we are reading the excel from cloud(AWS S3 bucket)
workbook = new Aspose.Cells.Workbook(excelStream, loadOptions);
workbook.Save(“filename.xlsx”);
I have checked passing FileSream(from sample code) as input we are getting the comments correctly but passing the MemoryStream(in our application) we are not getting the comments loaded.
Can you please help understand the behavior in the above two cases and also if it supports/will support MemoryStream?
Would you please check and confirm the MemoryStream contains the same data with the template file(you may save the data of it to a file and then compare the binary data of both files)? Also please make sure the pointer of the MemoryStream is just at the beginning(you may use excelStream.Seek(0, SeekOrigin.Begin) to assure that before using it to load Workbook).
MemoryStream mem;
//Fetching data from S3 bucket: {bucket}",bucket
GetObjectResponse gors = await _Client.GetObjectAsync(bucket, key);
mem = new MemoryStream(); //S3 returns an stream that is not seekable
await gors.ResponseStream.CopyToAsync(mem);
gors.ResponseStream.Dispose();
mem.Seek(0, SeekOrigin.Begin);
gors.ResponseStream = mem;
and while loading
//convertedExcelDocument = gors.ResponseStream workbook = new Aspose.Cells.Workbook(convertedExcelDocument, loadOptions);
workbook.Save(“AddThreadedComments_out.xlsx”);
Note - I have checked the workBook - It is having the comments and notes but when calling the .Save only notes is displayed but not the comments in the AddThreadedComments_out.xlsx.
We cannot reproduce the issue even when loading the workbook from MemoryStream. Maybe there are some special settings for the “loadOptions” in your code? To trace the issue, please create one console application which can reproduce the issue and send it to us so we can try to figure the issue out. For the MemoryStream, we think you can just build it from the template file(if you are sure that the data you got from S3 is same with the template file’s data).