Below is an exception I get when calling Workbook.Save("test.xlsx", FileFormatType.Excel2007Xlsx, SaveType.OpenInExcel, this.Response); I'm using ASP.NET and writing the code in c#. Aspose.Cells.dll is version 4.8.2.0.
I've previously called Workbook.Open with the excel file being an xlsx file of 2007 format. If the file opened is not 2007 format, the save works fine. The xlsx file has a chart on sheet1 and data cells in sheet 2.
All the Best,
Rich
[ArgumentOutOfRangeException: Index and length must refer to a location within the string. Parameter name: length] System.String.InternalSubStringWithChecks(Int32 startIndex, Int32 length, Boolean fAlwaysCopy) +7493051 xabb58b8f2887ff8e.xbb82d008db095c0c.x90ba9cfb3c794a97(XmlTextWriter xbdfb620b7167944b, x7a84bb5831c19d42 xd9f58b067c82c962) +195 xabb58b8f2887ff8e.xbb82d008db095c0c.x560fbd2662be66b1(XmlTextWriter xbdfb620b7167944b, Title x37a96021dbbe3532) +115 xabb58b8f2887ff8e.xbb82d008db095c0c.xbc9d71eb0d192ce6(XmlTextWriter xbdfb620b7167944b, Title x37a96021dbbe3532) +84 xabb58b8f2887ff8e.xbb82d008db095c0c.xf30f94ec3f1ada09(XmlTextWriter xbdfb620b7167944b) +54 xabb58b8f2887ff8e.xbb82d008db095c0c.x6210059f049f0d48(XmlTextWriter xbdfb620b7167944b) +270 xabb58b8f2887ff8e.xb440dd60010e3cc4.xea5674e36a812ab0(x6fc54f8ba8aae1d4 xd9171314ec0b2957) +222 xabb58b8f2887ff8e.xb440dd60010e3cc4.xc228659948392f83(x6fc54f8ba8aae1d4 xd9171314ec0b2957) +98 xabb58b8f2887ff8e.xb440dd60010e3cc4.x6b3641eeb6a37b82() +83 xabb58b8f2887ff8e.xb440dd60010e3cc4.x6210059f049f0d48() +149 Aspose.Cells.Workbook.Save(Stream stream, FileFormatType fileFormatType) +986 Aspose.Cells.Workbook.Save(String fileName, SaveType saveType, FileFormatType fileFormatType, HttpResponse response) +788 Aspose.Cells.Workbook.Save(String fileName, FileFormatType fileFormatType, SaveType saveType, HttpResponse response) +17
If you use Replace instead it works fine. I've also attached the xlsx file that I use.
All the Best,
Rich
using System; using System.Data; using System.Configuration; using System.Collections; using System.Web; using System.Web.Security; using System.Web.UI; using System.Web.UI.WebControls; using System.Web.UI.WebControls.WebParts; using System.Web.UI.HtmlControls; using Aspose.Cells;
namespace WebAsposeApplication { public partial class _Default : System.Web.UI.Page { protected void Page_Load(object sender, EventArgs e) {
Aspose.Cells.License license = new Aspose.Cells.License(); license.SetLicense("Aspose.Cells.lic");
Thanks for providing us the template file with sample code.
We found the issue after an initial test using your code and template file.
Your issue has been added to our internal issue tracking system with an issue id: CELLSNET-13422. We will figure it out soon and keep you updated about the issue.