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

Free Support Forum - aspose.com

Use of PPTX template

Please assist with removing major grid line in. (horizontal axis major gridlines)

Thanks,

Prasad

Hi Prasad,

Please try using the following sample code on your end to serve the purpose.

//Setting Major grid lines format for value axis
chart.Axes.VerticalAxis.MajorGridLinesFormat.Line.FillFormat.FillType = FillType.NoFill;

//Setting Minor grid lines format for value axis
chart.Axes.VerticalAxis.MinorGridLinesFormat.Line.FillFormat.FillType = FillType.NoFill;

//Setting Major grid lines format for value axis
chart.Axes.HorizontalAxis.MajorGridLinesFormat.Line.FillFormat.FillType = FillType.NoFill;

//Setting Minor grid lines format for value axis
chart.Axes.HorizontalAxis.MinorGridLinesFormat.Line.FillFormat.FillType = FillType.NoFill;


Many Thanks,

Hi Mudassir,


We want to add a benchmark value in chart for each category.
Please assist.
Screenshot is attached.

Thanks in advance.

Prasad

Hi Prasad,

I have observed your requirements and like to share there is no such option of setting benchmark value for chart data in PowerPoint as per my understanding. If there is any mechanism available in charts to do that then please share that with us and we will investigate that on our end. The one option that is available is to try using and fitting chart trend lines features in your approach if that is workable on your end. The requested support is unavailable in Aspose.Slides. Please share the details about setting benchmark values inside chart and we will try to help you further in this regard.

Many Thanks,

Hi Mudassir,

1. We will be having percentage value to draw a vertical line on percentage chart. (i.e. percentage value would be 40% then on chart there will be a vertical line at 40% points) snapshot attached. Advice on this.

2. I am getting integer values from database to draw a percentage chart and i want to show data label as "57%". And want to set font height as 10 but when we override 57 with "57%" then font size is not changing. Please observe attachments.

code:

IDataLabel lbl = series.DataPoints[1].Label;

lbl.TextFormat.PortionFormat.FontHeight = 10;

lbl.AddTextFrameForOverriding(Convert.ToString(dt.Rows[i]["Percentage"]) + "%");

Thanks,

Prasad

Hi Prasad,

For point 1 concerning to calculating the percentage, I regret to share that there is no direct property available to identify this. However, you can calculate the percentage for category values. For this, you need to get the total sum by adding all the concerned series values used in desired chart category. Then you can divide individual series values inside the desired category with total sum *100. Please visit this thread link for your reference and to develop logic on your end.

For your second query concerning to setting the custom text format. Please try using the following sample code on your end. I hope this will be helpful. Please share, if I may help you further in this regard.

lbl = series.DataPoints[1].Label;
lbl.AddTextFrameForOverriding("");
lbl.TextFrameForOverriding.Paragraphs[0].Portions[0].Text = Convert.ToString(dt.Rows[i][“Percentage”]) + “%”;
lbl.TextFrameForOverriding.Paragraphs[0].Portions[0].PortionFormat.FontHeight = 10;

Many Thanks,

Hi Mudassir,


Below is my business requirement.
I will be having data from database which will contain
1.Section (Heading)
2.Subsection (Sub Heading)
3.Subsection 2(Sub Heading 2)
3.year (Category)
4.Response (Series)
Chart will be the percentage stacked bar chart. and at a time depending on parameter multiple slides we want to generate (lets say 100 slides. which will have multiple charts).
and we have to place that each chart on slide.

so there are some questions i have and some suggestions i want to implement this thing using aspose slide.

1. Is there any way to avoid setting up the co-ordination for each chart ( as i am placing each chart on slide by setting there x and y co-ordinate along with there height and width).

2. is there any table structure available to put charts in aligned manner. (i will be creating one table in slide and adding chart in particular cell lets say 3 charts per slide).

3. Every chart will be produced through for loop so any suggestion to add slide dynamically and arrange all Charts. so that formation of chart will be structured.

Please assist on the above scenarios. and let me know if you need any additional details on this.

Thanks,
Prasad

Hi Prasad,


I have observed your requirement and if I sum up, you actually wish to add two or three charts per slide and want to organize them in slide. Right?. In this scenario, you can easily manage the things. Let me share some rough logic with you that you can employ on your end to get the desired results. The default presentation height is 540 usually. So you need to add charts in slide whose collective height + offset between charts must not be greater than slide height. For example, if you ought to add three charts per slide then you may set the height of chart 170. So 170 * 3=510 and let 10 be the offsets between charts. So collectively it will become 540. The following sample code exhibits the exact logic that I am trying to explain and I am hopeful, it will help you. As far as adding chart inside table is concerned, I am afraid this in not even possible in PowerPoint to add chart inside table cell.

public static void addCharts()
{
Presentation pres = new Presentation();

int number_of_Charts = 11;
int iOffsetbetweenCharts = 10;

ISlide slide = pres.Slides[0]; ;

float iChartHeight = (pres.SlideSize.Size.Height - iOffsetbetweenCharts3) / 3;//-30 to set offset between charts
float iChartWidth = 300;//Any value you want to set

float iChartXPosition = 50;
float iChartYPosition = iOffsetbetweenCharts;//First chart Y position

int iChartCountPerSlide = 1;
for (int i = 0; i < number_of_Charts; i++)
{
IChart chart=slide.Shapes.AddChart(ChartType.ClusteredBar,iChartXPosition,iChartYPosition,iChartWidth,iChartHeight);

iChartYPosition =iChartCountPerSlide iChartHeight + iOffsetbetweenCharts;

iChartCountPerSlide++;

if(i>0 && (i+1) % 3==0)// After every 3 slides add new slide in collection
{
slide=pres.Slides.AddEmptySlide(pres.LayoutSlides.GetByType(SlideLayoutType.Blank));
//Reset the chart height
iChartYPosition = iOffsetbetweenCharts;
iChartCountPerSlide = 1;
}

}

pres.Save(“C:\Presentations\TestChart.pptx”,SaveFormat.Pptx);

}

Many Thanks,

1.Can we reduce space between two chart bars? (refer above chart)?

2.Is there any way to add multiple charts without legends and add legend at the bottom of the slide?

3. i will be having different count of chart for each slide. and some charts will have multiple charts series and categories (want this in loop). please share the sample code.

Thanks,

Prasad

Hi Prasad,

I have observed your requirements and like to share that you can show hide the legends and can also set their position if the are shown. The following lines of code responsible for setting legend visibility and position.

chart.HasLegend = true;//If false then legend will not be visible
chart.Legend.Position = LegendPositionType.Bottom;

Can you please share what actually you mean by space between two charts. Lastly, for point 3, I have shared the generic scheme for your convenience to place multiple charts aligned on one slide. You please now need to develop your own logic for making charts with multiple series and categories.

Many Thanks,

Hi,


We got license of Aspose API. :slight_smile:
We have some questions.
1. I am using chart type as StackedBar, but the data which I am putting into chart series is not occupying proper space. please find attached output(IMG1).eg. chart with 7% occupying 50% space.
2. Is there any property to get exact height of Series, please find marked section in attachment.

Thanks,
Prasad

Also please let me know how to get upper and lower spacing in chart?


Thanks,
Praad

Hi Prasad,

Thank you for the details.

PrasadD:
1.
I am using chart type as StackedBar, but the data which I am putting
into chart series is not occupying proper space. please find attached
output(IMG1).eg. chart with 7% occupying 50% space.


Please share the sample code and generated file with us to help us reproduce the issue at our end. We will check it and get back to you.

PrasadD:

2. Is there any property to get exact height of Series, please find marked section in attachment.


I am afraid, this feature is not available in Aspose.Slides and also, it is not available in MS PowerPoint.

PrasadD:

Also please let me know how to get upper and lower spacing in chart?


Please provide some more details, preferably with some sample to help us understand your requirement. We will check it and provide you a solution accordingly.

Thanks & Regards,

Hi,


We are trying to add image with trasperent background in table using ASPOSE slides,

But still its showing background as white color instead of showing default color.

PFA image in which we have added blue and red Dot image.

We are sharing snapshot and sample code to understand us better.

plz find below code

double[] dblCols = { 50, 50, 50 };
double[] dblRows = { 50, 30, 30, 30, 30 };
//Add table shape to slide
ITable tbl = sld.Shapes.AddTable(100, 50,dblCols,dblRows);

//Add text to the merged cell
IPPImage imgx;
tbl[1, 1].FillFormat.FillType = FillType.Pattern;// “Merged Cells”;
imgx = pres.Images.AddImage(createbitmap("#00B0F0"));
tbl[1, 1].FillFormat.FillType = FillType.Picture;
tbl[1, 1].FillFormat.PictureFillFormat.PictureFillMode = PictureFillMode.Stretch;
tbl[1, 1].FillFormat.PictureFillFormat.Picture.Image = imgx;

tbl[1, 2].FillFormat.FillType = FillType.Pattern;// “Merged Cells”;
imgx = pres.Images.AddImage(ImagePath); // added image with trasperent background
tbl[1, 2].FillFormat.FillType = FillType.Picture;
tbl[1, 2].FillFormat.PictureFillFormat.PictureFillMode = PictureFillMode.Stretch;
tbl[1, 2].FillFormat.PictureFillFormat.Picture.Image = imgx;

//Write PPTX to Disk
pres.Save(dataDir + “/table.pptx”, SaveFormat.Pptx);


Hi Prasad,

I have observed your requirement and like to share that Aspose.Slides supports transparent background image if the image is really with transparent background. In your case the slide background is white and that is why it is appearing as white. You can try setting the slide background color to some other color and you will see the effect. If there is still an issue then please share the sample transparent image with me and I will help you further in this regard.

Many Thanks,

Hi,

I have added table in ppt silde but unable to change the header color of the table.

Can anybody please let me know how the header color of the table can be changed.

The default template is applied to the table.

plz find attaced snap for reference.

Thanks,

Sumit

Hi Summit,

I have observed the requirement shared and suggest you to please try using the following sample code on your end to serve the purpose.

ICell cell = tbl[k, j];
cell.FillFormat.FillType = FillType.Solid;
cell.FillFormat.SolidFillColor.Color = Color.Red;

The tbl is ITable object. You can set the fill color for every cell to serve the purpose.

Many Thanks,

Hi,


I want to flip arrow angle so that it will point to opposit direction.
Please find below code which i used to generate arrow. and attached images to get clear picture.

In PPT we can change 3-D Rotaten X value to 180 then we are getting desired output.
Please let us know where we can set 3D Rotation X value in Aspose Slide.

using (Presentation pres = new Presentation())
{
ISlide sld = pres.Slides[0];
IAutoShape shp = sld.Shapes.AddAutoShape(ShapeType.Line, 150, 150, 63, 44);
shp.LineFormat.BeginArrowheadLength = LineArrowheadLength.Long;
shp.LineFormat.BeginArrowheadWidth = LineArrowheadWidth.Wide;
shp.LineFormat.BeginArrowheadStyle = LineArrowheadStyle.Triangle;
shp.LineFormat.FillFormat.FillType = FillType.Solid;
pres.Save(dataDir+ “LineShape2.pptx”, SaveFormat.Pptx);
}

Thanks,
Prasad

Hi Prasad,

Thanks for your interest in Aspose.Slides.


I have observed your requirements and like to share that you can achieve the desired output by setting the Rotation property of shape. I have made necessary changes to the code sample shared by you to serve the purpose and about different values of Rotation property, I would like to add that Rotation property returns or sets the number of degrees the specified shape is rotated around the
z-axis. A positive value indicates clockwise rotation; a negative
value indicates counterclockwise rotation.

Presentation pres = new Presentation();
ISlide sld = pres.Slides[0];
IAutoShape shp = sld.Shapes.AddAutoShape(ShapeType.Line, 150, 150, 63, 44);
shp.LineFormat.BeginArrowheadLength = LineArrowheadLength.Long;
shp.LineFormat.BeginArrowheadWidth = LineArrowheadWidth.Wide;
shp.LineFormat.BeginArrowheadStyle = LineArrowheadStyle.Triangle;
shp.LineFormat.FillFormat.FillType = FillType.Solid;
shp.Rotation = 90;
pres.Save(@“D:\LineShape2.pptx”, Aspose.Slides.Export.SaveFormat.Pptx);

I hope this will be helpful. Please share if I may help you further in this regard.

Best Regards,

Hi Prasad,

I have observed the requirement shared by you and request you to please try using the following sample code to serve the purpose on your end. You need to set the rotation value for the shape that suits your requirement.

public static void TestTextEffects()
{
String dataDir = @“D:\Aspose Data”;
using (Presentation pres = new Presentation())
{
ISlide sld = pres.Slides[0];
IAutoShape shp = sld.Shapes.AddAutoShape(ShapeType.Line, 150, 150, 63, 44);
shp.LineFormat.BeginArrowheadLength = LineArrowheadLength.Long;
shp.LineFormat.BeginArrowheadWidth = LineArrowheadWidth.Wide;
shp.LineFormat.BeginArrowheadStyle = LineArrowheadStyle.Triangle;
shp.LineFormat.FillFormat.FillType = FillType.Solid;
shp.Rotation=90;
pres.Save(dataDir + “LineShape2.pptx”, SaveFormat.Pptx);
}

Many Thanks,