473,406 Members | 2,439 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,406 software developers and data experts.

PowerPoint slide produced by Spire is unreadable by PowerPoint

dbrewerton
115 100+
Hey folks, I have code that is supposed to generate a PowerPoint chart automatically. However, whenever I implement this code, it breaks the slide. No idea why it does this but whatever. So, here is the code to call the slide builder helper:

Expand|Select|Wrap|Line Numbers
  1.                 SqlCommand sqlcmdLOC = new SqlCommand(sqlQueryLOC, sqlconn);
  2.                 using (SqlDataAdapter da1 = new SqlDataAdapter(sqlcmdLOC))
  3.                 {
  4.                     DataTable dt1 = new DataTable();
  5.                     da1.Fill(dt1);
  6.                     InitChartData(chart1, dt1);
  7.                     sqlconn.Close();
  8.                 }
  9.  
That InitChartData(chart1, dt1) call goes into this routine:

Expand|Select|Wrap|Line Numbers
  1.         private static void InitChartData(IChart chart1, DataTable dt1)
  2.         {
  3.             //set series name
  4.             ChartSeriesFormatCollection ctf = chart1.Series;
  5.             for (int c = 0; c < dt1.Columns.Count; c++)
  6.             {
  7.                 chart1.ChartData[0, c].Text = dt1.Columns[c].Caption;
  8.                 if (c > 0)
  9.                 {
  10.                     ctf.Append(chart1.ChartData[0, c]);
  11.                 }
  12.             }
  13.             ChartCategoryCollection catg = chart1.Categories;
  14.             for (int r = 0; r < dt1.Rows.Count; r++)
  15.             {
  16.                 //set category
  17.                 catg.Append(chart1.ChartData[r + 1, 0]);
  18.  
  19.                 //set chartData value
  20.                 object[] data = dt1.Rows[r].ItemArray;
  21.  
  22.                 for (int c = 0; c < data.Length; c++)
  23.                 {
  24.                     chart1.ChartData[r + 1, c].Value = data[c];
  25.                 }
  26.                 //set series value
  27.                 for (int i = 0; i < ctf.Count; i++)
  28.                 {
  29.                     chart1.Series[i].Values.Add(chart1.ChartData[r + 1, i + 1]);
  30.                 }
  31.             }
  32.         }
  33.  
Attached Files
File Type: pptx slide_1_15_2020-19-16-58.pptx (121.0 KB, 133 views)
Jan 15 '20 #1
1 1444
SioSio
272 256MB
If you have a question about a commercial library, you can get a better answer by asking a question on a dedicated site.
https://www.e-iceblue.com/forum/
Jan 16 '20 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

2
by: DC | last post by:
I have created the following abstract class: public abstract class BaseC { protected int _ID; protected string _name; protected abstract DataTable GetData(int ID); // intended to hit data...
1
by: TdJ | last post by:
No end of reading on the net and I can not get this to compile! The error message is: An object reference is required for the nonstatic field, method, or property...
5
by: Vicky via DotNetMonster.com | last post by:
Hi, I need help with "An object reference is required for the nonstatic field, method, or property 'dataReader.Class1.data'" Before I put folowing variable in class level, it works fine....
1
by: Bucko | last post by:
Hi guys, this may be an easy for someone... I have a situation like below. The "str" string variable (and any other variable that VS.net declares normally in this space) can be used fine in...
2
by: Beffmans | last post by:
Hi When I run this code: using System; namespace DelegateProject { public delegate void MyDelegate(string s);
2
by: simonZ | last post by:
I have class, which returns dataTable to populate my list box on some other pages: public class dataClass { private Int16 _lvlRights=1 public static DataTable dtAdv() {
2
by: Mike | last post by:
ASP.NET 2.0 I have some code working in a code-behind that I want to move to a utility class. In the code behind, I can reference the querystring and get the Page value easily. However, when...
1
by: =?Utf-8?B?QUEyZTcyRQ==?= | last post by:
I am getting the above error with this Class Library code: namespace ClassLibrary1 { public class Class1 { private string FoundPathKey; public string LastError { get { return FoundPathKey; }
2
by: rameshonweb | last post by:
Iam getting the error an object reference is required for the nonstatic field method or property 'System.Windows.Forms.Control.CreateGraphics()' for this part of code public static void...
4
by: cppquester | last post by:
I have a data set MMSDataAccess with: public partial class MMSDataSet : System.Data.DataSet { ... private TB_ACTHEATDATADataTable tableTB_ACTHEATDATA; ...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.