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.

Fri Sep 21, 2018 9:33 am

Hi all !

I'm trying, for the first time, to edit the series of my existing graphs.

I would like to open my Excel template and edit the 5 series of datas I already have.

I don't have to create new graphs or series ... just edit what I already have.


Any suggestion ?


Thanks !

LUCA
User avatar

luca.demori
 
Posts: 10
Joined: Fri Mar 23, 2018 1:55 pm

Fri Sep 21, 2018 11:27 am

Hello Luca,

Thanks for your inquiry.
To help us better understand and investigate your issue, please provide your Excel template and your desired result. Thanks in advance.

Sincerely,
Lisa
E-iceblue support team
User avatar

Lisa.Li
 
Posts: 1261
Joined: Wed Apr 25, 2018 3:20 am

Fri Sep 21, 2018 1:25 pm

Hi Lisa,

I attach my Excel file.

As you can see, I have some graphs in the first worksheet ... the vales of the charts will be printed in the second worksheet.

I would like to "edit" the series of the graphs: if I'll have more rows in the series, I'll need to "expand" my actual selection.

At the end, I'll print just the first page to the user.
Attachments
result.zip
(20.77 KiB) Downloaded 283 times
User avatar

luca.demori
 
Posts: 10
Joined: Fri Mar 23, 2018 1:55 pm

Mon Sep 24, 2018 9:26 am

Hi,

Thanks for your sharing.
I will look into your issue and reply you asap.

Sincerely,
Nina
E-iceblue support team
User avatar

Nina.Tang
 
Posts: 1182
Joined: Tue Sep 27, 2016 1:06 am

Tue Sep 25, 2018 7:15 am

thanks Nina
User avatar

luca.demori
 
Posts: 10
Joined: Fri Mar 23, 2018 1:55 pm

Tue Sep 25, 2018 10:14 am

Hi,

Thanks for your waiting.
Please try below code to modify the existing series data of chart. If it doesn't meet your need, please provide your expected output for our reference.
Code: Select all
Workbook workbook = new Workbook();
workbook.LoadFromFile("result.xlsx");
Worksheet sheet = workbook.Worksheets["report"];
Worksheet sheet1 = workbook.Worksheets["valori"];

//Get the first chart
Chart chart = sheet.Charts[0];

sheet1.Range["B11"].Value = "10";
sheet1.Range["C11"].Value = "20";

//Re-specify the data range of chart
chart.DataRange = sheet1.Range["B2:C11"];

//Change the value of series
var cs1 = (ChartSerie)chart.Series[0];
cs1.Values = sheet1.Range["C4:C11"];

workbook.SaveToFile("Myresult.xlsx", ExcelVersion.Version2013);

Sincerely,
Nina
E-iceblue support team
User avatar

Nina.Tang
 
Posts: 1182
Joined: Tue Sep 27, 2016 1:06 am

Tue Sep 25, 2018 3:44 pm

Thanks for your support Nina ... it works !


I only needed to insert again the "CategoryLabels" that were deleted ...

csAssetClass.CategoryLabels = sheetValori.Range["B4:B11"];



thanks again !
User avatar

luca.demori
 
Posts: 10
Joined: Fri Mar 23, 2018 1:55 pm

Wed Sep 26, 2018 1:41 am

Hi,

Thanks for your feedback.
If you need helps in the future, please feel free to contact us.
Have a nice day!

Sincerely,
Nina
E-iceblue support team
User avatar

Nina.Tang
 
Posts: 1182
Joined: Tue Sep 27, 2016 1:06 am

Wed Sep 26, 2018 2:28 pm

Hi Nina,

yes ... I would like to take advantage of your help.

My final step is to create di XLS file (now it works fine) and save it in PDF format.

At the moment I'm able to print all the workbook with the following ...

workbook.SaveToStream(streamDatiPDF, Spire.Xls.FileFormat.PDF);


As you can see, I need the output as a STREAM ... not a file ...


This is my question: I need to print just the FIRST worksheet ... not all the workbook.


It it possibile ?


Thanks again ...

LUCA
User avatar

luca.demori
 
Posts: 10
Joined: Fri Mar 23, 2018 1:55 pm

Thu Sep 27, 2018 6:01 am

Hello,

Thanks for your inquiry.
You could use below code to convert the specific worksheet to Pdf stream.
Code: Select all
 MemoryStream stream=new MemoryStream();
//Save the first worksheet to Pdf stream
 workbook.Worksheets[0].SaveToPdfStream(stream);

Sincerely,
Nina
E-iceblue support team
User avatar

Nina.Tang
 
Posts: 1182
Joined: Tue Sep 27, 2016 1:06 am

Thu Sep 27, 2018 8:36 am

Nina ... I need to thank you once again !


It works great ! 8)



Last help ...


when I worked with Microsoft Excel Object Library (COM library) I had the opportunity to use Excel.Visible = True to visualize in realtime what my code do, and debug it


Is there a way to keep Excel VISIBLE with Spire.XLS ?


Thanks !


LUCA
User avatar

luca.demori
 
Posts: 10
Joined: Fri Mar 23, 2018 1:55 pm

Thu Sep 27, 2018 9:43 am

Hello,

Thanks for your feedback.
Sorry that our Spire.XLS doesn't has such function which allows user to visualize in realtime what the code do. If you have other questions, welcome to write back.

Sincerely,
Nina
E-iceblue support team
User avatar

Nina.Tang
 
Posts: 1182
Joined: Tue Sep 27, 2016 1:06 am

Thu Sep 27, 2018 9:58 am

ok ... thanks again for your precious help !



LUCA
User avatar

luca.demori
 
Posts: 10
Joined: Fri Mar 23, 2018 1:55 pm

Fri Sep 28, 2018 2:00 am

Hello,

You're welcome.
Welcome to contact us in case of any further question.
Have a nice day!

Sincerely,
Nina
E-iceblue support team
User avatar

Nina.Tang
 
Posts: 1182
Joined: Tue Sep 27, 2016 1:06 am

Return to Spire.XLS