Spire.XLS is a professional Excel API that enables developers to create, manage, manipulate, convert and print Excel worksheets. Get free and professional technical support for Spire.XLS for .NET, Java, Android, C++, Python.

Wed Mar 06, 2013 3:31 am

Dear Support,

I was curious if you could look into something for me/clarify the support of a scenario. I have a spreadsheet that I would like to insert data into and that spreadsheet has a graph defined in it. Can I:

1. Insert the data (this is normal - so yes)
2. Modify the graph (x-axis, y-axis, size, etc.)
3. Save the document

#1 and #3 are a yes because I do it all the time. #2 is my big question mark.

Lastly, right now with my spreadsheet when I insert the data and open it, I get an error File Error: Data may have been lost. I have several examples that I can forward.

Thanks,

Richard

rbrynteson
 
Posts: 11
Joined: Wed Jun 20, 2012 3:58 am

Thu Mar 07, 2013 10:17 am

Dear Richard,

Thanks for your inquiry.
For #2, please try sample code below. We attached the tested excel files.
Code: Select all
           Workbook workbook = new Workbook();
            workbook.LoadFromFile(@"..\..\sample.xlsx");
 
            Chart chart = workbook.Worksheets[0].Charts[0];
           //modify chart size
            chart.Height = 500;
            chart.Width = 700;
           
          //modify y-axis minValue and maxValue
            chart.PrimaryValueAxis.MaxValue = 12000;
            chart.PrimaryValueAxis.MinValue = 0;
         
            //modify x-axis title
            chart.PrimaryCategoryAxis.Title = "Month(Jun-Sep)";

            chart.PrimaryValueAxis.HasMajorGridLines = true;
            workbook.SaveToFile("result.xlsx",ExcelVersion.Version2007);

For an error File Error, could you please provide us your template file, data and code? So that we can reproduce the error you met soon and work out a solution for you. Thank you in advance!

Best regards,
Amy
E-iceblue support team
Attachments
excelFiles.zip
(18.98 KiB) Downloaded 365 times
User avatar

amy.zhao
 
Posts: 2766
Joined: Wed Jun 27, 2012 8:50 am

Thu Mar 14, 2013 9:09 am

Dear Richard,

Did our previous code solve this issue #2? Do you get an error File Error when insert the data into your spreadsheetand open it?
If you have any issue, please tell us.

Best regards,
Amy
E-iceblue support team
User avatar

amy.zhao
 
Posts: 2766
Joined: Wed Jun 27, 2012 8:50 am

Tue Apr 02, 2013 1:43 am

Amy,

Sorry I was out of town and the forums reply where going to my spam so I didn't see them.

So I tried the file you attached and it works fine so there must be something about my file. I will follow up with an e-mail on the file that I'm using and maybe you can reproduce the error.

Thanks,

Richard

rbrynteson
 
Posts: 11
Joined: Wed Jun 20, 2012 3:58 am

Tue Apr 02, 2013 8:30 am

Dear Richard,

Thanks for your feedback.
We have recieved your file from your e-mail. It helps us reproduce this error. I have posted it to our dev team. Sorry for the inconvenience. My dev colleague will do some researches to find out the cause which caused this error and solve it.
Once have any update on this issue, we will tell you immediately.

Best Regards,
Amy
E-iceblue support team
User avatar

amy.zhao
 
Posts: 2766
Joined: Wed Jun 27, 2012 8:50 am

Return to Spire.XLS