We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

Change image and keep size

Hi,

We have an issue with image size.

If we change the image multiple times the size is decreasing.

We use this code to change the image content with Aspose.Cells 7.3.0.0 (this is the only version who's working correclty on SharePoint 2010).

worksheet.Pictures[0].Data = imagedata;

Regards,

JD

Hi,

We recommend you to kindly try with our latest version/fix Aspose.Cells for SharePoint, if it works fine.

If you still find the issue, we need your sample application (please create it and you may zip it prior attaching here) to reproduce the issue on our end. Also attach the template Excel and image file here, we will check your issue soon.

Thank you.

In attachment you can find a VS2010 solution with code and explanation.

There are two issue in this solution.

1. File corrupted on save

2. Image size descreasing on change

Regards,

J.D.

Hi,


Thanks for the sample project.

I am using v7.5.0.x (latest version).

1) I can notice the issue as you mentioned by running your sample case 1 in your project. The output file is always corrupted. I have logged a ticket with an id “CELLSNET-41787” for your issue. We will look into your issue soon.

Once we have any update on it, we will let you know here.


2) We could not spot the issue, could you elaborate it more and provide us more details with screen shots to highlight the issue, we will check and log it into our database (if we found the issue) with enough details, so it could be figured out properly.

Thank you.

Hi,

Thanks for your posting and using Aspose.Cells for .NET.

We have fixed the issue.

Please download and try this fix: Aspose.Cells for .NET (Latest Version) and let us know your feedback.

The issues you have found earlier (filed as CELLSNET-41787) have been fixed in this update.


This message was posted using Notification2Forum from Downloads module by Aspose Notifier.

Hi,

I have made some change in the projet in attachment.

Please execute the "Change picture 10 times". After that a new file is generated and a sample is present (sample that contain the picture with the correct size).

I gonna try the latest version for file corrupted on save. I hope that version work correctly with the Sharepoint 2010 Office Document Parser

Regards,

J.D.

JDeb:

Hi,

I have made some change in the projet in attachment.

Please execute the "Change picture 10 times". After that a new file is generated and a sample is present (sample that contain the picture with the correct size).

I gonna try the latest version for file corrupted on save. I hope that version work correctly with the Sharepoint 2010 Office Document Parser

Regards,

J.D.

Can you try the "Change picture 10 times" with Aspose.Cells 7.5.1.0 the issue is different.

Regards,

J.D.

In attachment a new solution with Aspose.Cells 7.5.1.0

Please execute option 5 "File corrupted after picture change"

the file is corrupted after the picture or tag change.

Regards,

J.D.

Hi,

Thanks for your posting and using Aspose.Cells for .NET

Please download and try the latest version Aspose.Cells for .NET (Latest Version) and see if it resolves your issue.

If your issue still occurs, please highlight your issue in screenshots with red circles. It will help us look into your issue precisely and we will be able to help you.

Hi,

Issues are still the sames with the latest version.

screenshots in attachments.

Hi,

Thanks for your posting and using Aspose.Cells for .NET.

We were able to observe these issues using your demo and source files. We have logged these issues in our database. We will look into it and fix these issues. Once, the issues are resolved or we have some other update for you, we will let you know asap.

Change picture 10 times issue has been logged as CELLSNET-41880.

File corrupted after picture change issue has been logged as CELLSNET-41881.

Hi,


For your issue(s): CELLSNET-41881

We think it's the issue of your codes. The size of the generated file is less than the base file, so, if you use the same stream, some useless data will be exported too.

a) Reset the size of stream, see the following codes:

private static void case1()

{

File.Copy(@"Files\case1\ModeleAnalyseChimique_BASE.xlsm", @"Files\case1\ModeleAnalyseChimique.xlsm", true);

using (FileStream reportStream = new FileStream(@"Files\case1\ModeleAnalyseChimique.xlsm", FileMode.Open))

{

try

{

Workbook wb = new Workbook(reportStream);

reportStream.SetLength(0x400);

wb.Save(reportStream, SaveFormat.Xlsm);

}

catch (Exception ex)

{

Console.WriteLine(ex.Message);

Console.Read();

}

}

}

b) Removing codes about File.Copy, See the following codes:

private static void case1()

{

//File.Copy(@"Files\case1\ModeleAnalyseChimique_BASE.xlsm", @"Files\case1\ModeleAnalyseChimique.xlsm", true);

using (FileStream reportStream = new FileStream(@"Files\case1\ModeleAnalyseChimique.xlsm", FileMode.Create))

{

try

{

Workbook wb = new Workbook(@"Files\case1\ModeleAnalyseChimique_BASE.xlsm");

wb.Save(reportStream, SaveFormat.Xlsm);

}

catch (Exception ex)

{

Console.WriteLine(ex.Message);

Console.Read();

}

}

}



Thank you.

Thank you for your reply and explanation.

This problem is resolved !

Regards,

J.D.

Hi,

Thanks for your posting and using Aspose.Cells for .Net.

It is good to know that this issue is resolved with the given sample code. If you encounter any other issue, please feel free to post, we will be glad to help you further.

Hi,

Thanks for your posting and using Aspose.Cells for .NET.

We have fixed the issue i.e Change Picture 10 times.

Please download and try this fix: Aspose.Cells for .NET (Latest Version) and let us know your feedback.

Thank you for the fix.

But I have another issue, eof Exception with that code

Workbook wb = new Workbook(reportStream);

wb.Save(reportStream,

SaveFormat.Xlsm);

wb =new Workbook(reportStream);

wb.Save(reportStream,

SaveFormat.Xlsm);

Please see the CASE5 in the solution in attachment.

Regards,

J.D.

Hi,

Thanks for your posting and using Aspose.Cells for .NET.

We were able to replicate this exception using your source file and sample code. We have logged this issue in our database. We will look into it and fix this issue. Once, the issue is fixed or we have some other update for you, we will let you know asap.

This issue has been logged as CELLSNET-41945.

Hi,

Thanks for your posting and using Aspose.Cells for .NET.

It’ still the problem with your code.

Please check our previous
post ( Change image and keep size ),


If you open a stream and save the file to it, the generated file will be
corrupted if the size of the saved file is decreased.

Unexpected EOF
exception is thrown when opening a corrupted stream.

Please check the
following code:

C#


FileStream reportStream = new FileStream(@“D:\FileTemp\AsposeDemo_7.5.1.4\AsposeDemo\bin\Debug\Files\case5\BASE.xlsm”, FileMode.Open);

Workbook wb = new Workbook(reportStream);

reportStream.SetLength(0x400);

wb.Save(reportStream, SaveFormat.Xlsm);

wb = new Workbook(reportStream);

reportStream.SetLength(0x400);

wb.Save(reportStream, SaveFormat.Xlsm);


BTW, please do not open a stream and save the file to it, it's better closing the inputstream and re-creating an outstream.