PDF conversion of PPTX has problems

Hello.


I have noticed some problems in the PDF conversion of PPTX.
I attach a demo project that shows them all.

Here is a list of problems (by order of importance to me):
- 100% stacked bar charts are not generated correctly.
- The unit type (for the axes and data labels) are not taken into account most of the times.
- The chart axes color is not preserved.
- For some reason, in the 3rd chart, the blue line series color is not preserved (it becomes gray).
- The grid lines are not the same most of the times.
- Less urgent : When a series is placed on the secondary axis in a bar chart its bars are not positioned correctly on the plot area.
- This is much less urgent : Fills with effects or textures are not preserved.

Please, if possible, let me know when approximately could you fix at least the first 4 of them.

Best Regards,
Kostas

Hi Kostas,

I have worked with the sample presentation shared and have been able to observe a number of issues. An issue with ID SLIDESNET-34554 has been created to resolve the issue of improper Bar and Column chart rendering on slide 1 and slide 2. A new issue with ID SLIDESNET-34555 has been created to resolve the wrong values rendered for Value Axis of charts in presentation. An issue with ID SLIDESNET-34556 has been created to resolve the issue of wrong labels for chart labels. An issue with ID SLIDESNET-34557 has been created to resolve the missing or wrong colored chart series lines. A separate issue with ID SLIDESNET-34558 has been created to resolve the missing grid lines in charts. A new issue with ID SLIDESNET-34559 has been created to resolve the issue of patterns rendering as solid colors.

I like to share that all issues in Aspose.Slides forum are added with same normal priority. If you wish to expedite the resolution and prioritize the issues then please consider our Priority support options. You can consult Aspose.Purchase forum in this regard to avail priority support service. For your kind refernce, I have attached the images highlighting the incurring issues.

We are sorry for your inconvenience,

Hi.


I have found workarounds for most of those bugs.

However, I can’t understand what two proprties do:

The one is the AxisEx.Position and the other is the AxisEx.AxisBetweenCategories.

I have read the documentation but it seems that AxisEx.AxisBetweenCategories is superseded by AxisEx.CrossType and AxisEx.Position changes
nothing to the chart (only a bug in the PDF conversion appears when you set it - related to the axis title orientation).

Probably this is supposed to make the axis change it’s side relative to the chart (left/right, top/botton) but I don’t see it working.

I don’t know if I am missing sth.

Now my biggest priority is the axis color that is not preserved, the fill of some line series that is not preserved and also another problem that I’ve found:

When you insert null values in a line chart it doesn’t break the line at that point, but inserts a zero value instead.

Aspose Cells doesn’t have this problem (as far as I’ve seen). I have found a way to make the line seem broken (by adding two transparent
color points to the series) but I can’t make the marker and data-label to disapear.
Anyway, thanks for any help.

Kostas.

Hi again!


I have found the reason that causes the bug to the line series color (issue with ID SLIDESNET-34557).
It seems that when using a scheme color that is equal to color ‘Text2’ the color is not copied right.
In fact, I can’t even find the Text2 color in the MasterSlideEx properties!
Here is the function tht I use to try to workaround the bug:

		//--------------------------------------------------------------------------------------------
public static void CopyColorFormatAsRBG(ColorFormatEx pDestColFormat, ColorFormatEx pSrcColFormat, PresentationEx pPres)
{
if (pDestColFormat == null || pSrcColFormat == null) return;
		<span style="color:blue;">var</span> ct = pSrcColFormat.ColorType;
		pDestColFormat.ColorType = ct;
		<span style="color:blue;">if</span> (ct == <span style="color:#2b91af;">ColorTypeEx</span>.NotDefined)
		{
		}
		<span style="color:blue;">else</span> <span style="color:blue;">if</span> (ct == <span style="color:#2b91af;">ColorTypeEx</span>.RGB || ct == <span style="color:#2b91af;">ColorTypeEx</span>.HSL || ct == <span style="color:#2b91af;">ColorTypeEx</span>.RGBPercentage)
		{
			pDestColFormat.Color = pSrcColFormat.Color;
		}
		<span style="color:blue;">else</span> <span style="color:blue;">if</span> (ct == <span style="color:#2b91af;">ColorTypeEx</span>.Scheme)
		{</pre><pre style="font-family: Consolas; font-size: 13px; background-color: white; background-position: initial initial; background-repeat: initial initial;"><pre style="font-family: Consolas; background-position: initial initial; background-repeat: initial initial;">				pDestColFormat.ColorType = <span style="color:#2b91af;">ColorTypeEx</span>.RGB;</pre>				<span style="color:blue;">var</span> cs = pPres.Masters[0].Theme.ColorScheme;
			<span style="color:blue;">switch</span> (pSrcColFormat.SchemeColor)
			{
				<span style="color:blue;">case</span> <span style="color:#2b91af;">SchemeColorEx</span>.Accent1:
					CopyColorFormat(pDestColFormat, cs.Accent1);
					 <span style="color:blue;">break</span>;
				<span style="color:blue;">case</span> <span style="color:#2b91af;">SchemeColorEx</span>.Accent2:
					 CopyColorFormat(pDestColFormat, cs.Accent2);
					 <span style="color:blue;">break</span>;
				<span style="color:blue;">case</span> <span style="color:#2b91af;">SchemeColorEx</span>.Accent3:
					 CopyColorFormat(pDestColFormat, cs.Accent3);
					 <span style="color:blue;">break</span>;
				<span style="color:blue;">case</span> <span style="color:#2b91af;">SchemeColorEx</span>.Accent4:
					 CopyColorFormat(pDestColFormat, cs.Accent4);
					 <span style="color:blue;">break</span>;
				<span style="color:blue;">case</span> <span style="color:#2b91af;">SchemeColorEx</span>.Accent5:
					 CopyColorFormat(pDestColFormat, cs.Accent5);
					 <span style="color:blue;">break</span>;
				<span style="color:blue;">case</span> <span style="color:#2b91af;">SchemeColorEx</span>.Accent6:
					 CopyColorFormat(pDestColFormat, cs.Accent6);
					 <span style="color:blue;">break</span>;
				<span style="color:blue;">case</span> <span style="color:#2b91af;">SchemeColorEx</span>.Dark1:
					 CopyColorFormat(pDestColFormat, cs.Dark1);
					 <span style="color:blue;">break</span>;
				<span style="color:blue;">case</span> <span style="color:#2b91af;">SchemeColorEx</span>.Dark2:
					 CopyColorFormat(pDestColFormat, cs.Dark2);
					 <span style="color:blue;">break</span>;
				<span style="color:blue;">case</span> <span style="color:#2b91af;">SchemeColorEx</span>.Light1:
					 CopyColorFormat(pDestColFormat, cs.Light1);
					 <span style="color:blue;">break</span>;
				<span style="color:blue;">case</span> <span style="color:#2b91af;">SchemeColorEx</span>.Light2:
					 CopyColorFormat(pDestColFormat, cs.Light2);
					 <span style="color:blue;">break</span>;
				<span style="color:blue;">case</span> <span style="color:#2b91af;">SchemeColorEx</span>.Hyperlink:
					 CopyColorFormat(pDestColFormat, cs.Hyperlink);
					 <span style="color:blue;">break</span>;
				<span style="color:blue;">case</span> <span style="color:#2b91af;">SchemeColorEx</span>.FollowedHyperlink:
					 CopyColorFormat(pDestColFormat, cs.FollowedHyperlink);
					 <span style="color:blue;">break</span>;


				<span style="color:blue;">case</span> <span style="color:#2b91af;">SchemeColorEx</span>.Text1:
					 CopyColorFormat(pDestColFormat, cs.Dark1);
					 <span style="color:blue;">break</span>;
				<span style="color:blue;">case</span> <span style="color:#2b91af;">SchemeColorEx</span>.Text2:
					 CopyColorFormat(pDestColFormat, cs.Dark2);
					 <span style="color:blue;">break</span>;
				<span style="color: blue;">case</span> <span style="color: rgb(43, 145, 175);">SchemeColorEx</span>.Background1:
					 CopyColorFormat(pDestColFormat, cs.Light1);
					 <span style="color: blue;">break</span>;</pre><pre style="font-family: Consolas; font-size: 13px; background-color: white; background-position: initial initial; background-repeat: initial initial;"><pre style="font-family: Consolas; background-position: initial initial; background-repeat: initial initial;">					<span style="color:blue;">case</span> <span style="color:#2b91af;">SchemeColorEx</span>.Background2:
					 CopyColorFormat(pDestColFormat, cs.Light2);
					 <span style="color:blue;">break</span>;</pre>
			}
		}
		<span style="color:blue;">else</span> <span style="color:blue;">if</span> (ct == <span style="color:#2b91af;">ColorTypeEx</span>.System) pDestColFormat.SystemColor = pSrcColFormat.SystemColor;
		<span style="color:blue;">else</span> <span style="color:blue;">if</span> (ct == <span style="color:#2b91af;">ColorTypeEx</span>.Preset) pDestColFormat.PresetColor = pSrcColFormat.PresetColor;</pre><pre style="font-family: Consolas; font-size: 13px; background-color: white; background-position: initial initial; background-repeat: initial initial;"><pre style="font-family: Consolas; background-position: initial initial; background-repeat: initial initial;">			pDestColFormat.ColorTransform.Clear();
		<span style="color:blue;">foreach</span> (<span style="color:blue;">var</span> col <span style="color:blue;">in</span> pSrcColFormat.ColorTransform)
		{
			<span style="color:blue;">var</span> co = (ColorOperationEx)col;
			pDestColFormat.ColorTransform.Add(co.OperationType, co.Parameter);
		}</pre>		}</pre><pre style="font-family: Consolas; font-size: 13px; background-color: white; background-position: initial initial; background-repeat: initial initial;"><br></pre><pre style="font-family: Consolas; font-size: 13px; background-color: white; background-position: initial initial; background-repeat: initial initial;">This is supposed to be converting scheme colors to normal RBG colors so that the PDF convertor doesn't get confused.

However, I don’t see any Text1/Text2 scheme colors, so here I use Dark1/Dark2 scheme colors instead.
I have the same problem with Background1 and Background2.

Can I find somewhere the value of Text1/Text2/Background1/Background2 scheme colors ?
Thanks,
Kostas.

EDIT : I see that PowerPoint doesn’t have a setting for Text1/Text2/Background1/Background2 either.
It only has for Light1/Light2/Dark1/Dark2. So, why do I get a color scheme of value Text2 and why does Text2 even exist ?
EDIT2 : I have the impression that my code above (I have made some corrections) is correct and the colors are mapped correctly (now it seems that I get the correct series colors - unless there is another issue not visible yet).
I wonder, however, why Text1/Text2/Background1/Background2 exist…

Hi Kostas,

I have observed the argument shared by you and have not completely understand the requirements shared. I request you to please share the sample application that is using the above method for getting the colors. I will append the findings with concerned issue in Jira. As far as issue SLIDESNET-34557 is concerned, it was wrong rendering color for chart series in charts inside PDF. The internal details can be assessed by our development team and once you will share the sample application, I will share with them to investigate further.

Many Thanks,

OK. never mind. I think I have found a workaround to issue SLIDESNET-34557 (however it is only a workaround not a permanent solution).

My 1st attached project will be enough for your development team to solve this.

Perhaps if I find time I will add a new demo for the AxisEx.Position that doesn’t seem to work.

Kostas.

Hi Kostas,

I appreciate your efforts and thank you very much. Please share, if I may help you further in this regard.

Many Thanks,

Hello Mudassir.


A piece of my code (which is not posetd here) replaces system colors with RGB colors so that the PDF gets created correctly.
However, the system that produced the template PPTX may be different than the system the uses my template to produce the final report, so the system colors may not be the same in value.

I would like to know if there is a way of translating system colors into RGB colors without taking them from the current system settings like I do now.
As far as I see here : https://docs.microsoft.com/en-us/previous-versions/office/developer/office-2007/cc964302(v=office.12)?redirectedfrom=MSDN
…as well as inside the PPTX file format, system colors are declared ilke that:

<a:sysClr val=windowTextlastClr=000000/>

( Usually, system colors are defined in the theme files, e.g.: ppt/theme/theme 1xml )

However, with Aspose Slides it seems that I can only access the first attribute of the color (its name). As far as I understand, the second attribute is the color value of the system that created the PPTX and this value is what I need. I don’t know if I am wrong on this.
Is there a way to get this value somehow?

E.g. when I have :
ColorFormatEx pSrcColFormat;
To be able to call a function FromSystemColorToRGB() to get the RGB color from the master slide/theme:

if(pSrcColFormat != null && pSrcColFormat.ColorType == ColorTypeEx.System) return FromSystemColorToRGB(CurrentMaster, pSrcColFormat.SystemColor);

EDIT : I guess that a better solution would be to have a new property called “LastColor” that exposes this value when ColorType == ColorTypeEx.System.


Thanks,
Kostas.

Hi Kostas,


I have observed the requirements shared by you. Doesn’t the pSrcColFormat.SystemColor return the color value. I would really appreciate if you may please share a sample presentation with us from which you wish to extract the color value. Please also share the used sample code for reference and I will investigate further whether it is possible to extract the required information or not.

Many Thanks,

Hello.


No. The pSrcColFormat.SystemColor is an enumeration value, not an RGB color.
I attach a demo project.

I have created a presentation with a color defined in the theme as :

<a:dk1><a:sysClr val=“windowText” lastClr=“FF0000”/></a:dk1>

This is the “Dark 1” color of the theme, as far as I can tell.
Then, in the demo I try to copy this color from a table cell border to another cell border but as an RGB value (basically what I need is the “lastClr” attribute from above).
In the breakpoint inside CopyColorFormat() I need a way of getting that red color.
The current code retrieves the RGB value from the current system colors, but this is not always te same to the embedded value.

Thanks,
Kostas

Hi Kostas,

Many Thanks for sharing the sample project. I have worked with the sample project shared and have been able to observe the issue specified. It seems to be an issue with Aspose.Slides as it has wrongly parsed the RGB values. It must have been R=255, G=0 and B=0 but R value has also been parsed as 0. An issue with ID SLIDESNET-34609 has been created in our issue tracking system to further investigate and resolve the issue. This thread has been linked with the issue so that you may be automatically notified once the issue will be resolved.

We are sorry for your inconvenience,

The issues you have found earlier (filed as SLIDESNET-34557,SLIDESNET-34559,SLIDESNET-34558,SLIDESNET-34554,SLIDESNET-34556) have been fixed in this update.