Pattern in charts

Hi


We are goins to develop a solution for one of our clients who will buy a licence for the Aspose Slides for .NET (actually I don’t which kinda licence) and will provide us.

Meanwhile I’m performing a series of tests with the evaluation version.
At the moment I’m facing two problems:

1)
I open an existing pptx, change some parts of it (shapes text and data of a chart) but when save a single slide (I clone one slide into a new presentation e remove the default created one) that slide is missing the changes I made.
The workaround I found, up to now, is to “save” the edited PPTX, open it back again, and from here, extract the slide I need. It looks like I have to “commit” the changes I made to the shapes of the presentation. Am I missing something?

2)
One of the request of the client is to “protect” some slides from editing.
Unfortunately this feature is not allowed in Powerpoint (as it is in Excel), and so, the possible workaround would be to generate a picture (jpg, svg, or so) for each of the slides i want to protect, and the replace the content of the each slide with the corresponding picture.

I’ve already made some test, and it works, BUT … is the slides has a chart in it, and the chart elements are filled using PATTERN, the exported image (but also HTML, for example) is missing the pattern, replaced by solid color.
I made a test using a Bent Arrow shape, in that case the pattern is regularly saved also in the exported image.

Is this a limitation of the evaluation version of Slides, or is a missing feature, or also a bug?

Thank you for your answers
best Regards

Paolo Franceschini

Hi Paolo Franceschini,

Thanks for your growing interest in Aspose.Slides.

I have observed the requirements shared by you and will answer the questions shared by you in order they have been asked.

paolo.franceschini:

Hi

We are going to
develop a solution for one of our clients who will buy a licence for
the Aspose Slides for .NET (actually I don’t which kinda licence) and
will provide us.

In order to get the appropriate license type to meet your requirement, I suggest you to please consult Aspose.Purchase forum to our sales team. They will assist you better in getting the appropriate license type to suit your requirements. I may provide the technical help concerning to Aspose.Slides to you.

paolo.franceschini:

I
open an existing pptx, change some parts of it (shapes text and data of
a chart) but when save a single slide (I clone one slide into a new
presentation e remove the default created one) that slide is missing the
changes I made.

The workaround I found, up to now, is to
“save” the edited PPTX, open it back again, and from here, extract the
slide I need. It looks like I have to “commit” the changes I made to the
shapes of the presentation. Am I missing something?

I request you to please share the sample presentation and sample code for cloning slides for which you are getting the issue no data changed observed in saved presentation. I will observe the sample code, generated presentation and source presentation shared by you and help you further in this regard.

paolo.franceschini:

One of the request of the client is to “protect” some slides from editing.

Unfortunately
this feature is not allowed in Powerpoint (as it is in Excel), and so,
the possible workaround would be to generate a picture (jpg, svg, or so)
for each of the slides i want to protect, and the replace the content
of the each slide with the corresponding picture.

I like to share that Aspose.Slides offers the support for locking the presentation slides shapes and thus enabling you to protect them even in PowerPoint as well. This feature can be used to embed the watermark in your presentation as well. Please visit this documentation link for your kind reference in this regard.

paolo.franceschini:

I’ve
already made some test, and it works, BUT … is the slides has a chart
in it, and the chart elements are filled using PATTERN, the exported
image (but also HTML, for example) is missing the pattern, replaced by
solid color.

I made a test using a Bent Arrow shape, in that case the pattern is regularly saved also in the exported image.

Is this a limitation of the evaluation version of Slides, or is a missing feature, or also a bug?

I request you to please share the source presentation, generated output and sample code with me. I will investigate the issue further on my end to help you out.

PS: I suggest you to please try using Aspose.Slides for .NET 14.4.0 on your end first before sharing the feedback with us.

Many Thanks,

1) License

thank you very much for your information. Your licence policies are perfectly clear for me. What I meant is the the client itself will buy it according with their need, and I still don’t know which one they will choose :wink:

2) Protection
I will try your suggestion, but my doubt: since this feature is not supported by Powerpoint, what will happen when a user opens the “locked” presentation?

3) Find attached a full sample (web app). Here what i put in it:
a) template folder where you can find THE SOURCE pptx (present1.pptx)
b) default.aspx with some text boxes to change chart parameters
c) default.aspx with buttons
x1) DOWNLOAD PPT
this will change the chart e stream the result in response.
PROBLEM --> save the resulting PPT. If I open it with PowerPoint 2013 I get an error that
the presentation is corrupted, then PowerPoint repairs it
x2) PREVIEW ONE SLIDE
This button will change the chart data, extract the first slide and stream it in HTML format
PROBLEM --> the original PPT has two shapes and a series of the chart filled with a texture.
The resulting html is missing the texture in the chart (replaced by a dark yellow
color) and the two shapes are black
x3) GENERATE WMF FROM PPT - KO
This button will change the chart data and will generate 4 WMF images in the template
folder.
PROBLEMS --> Look at the first IMAGE (dummy_wmf_KO0.wmf), the texture in shapes
is perfect, the texture in chart is missing (only yellow color), but, more serous,
the first column (category), named CHANGED 2010, is MISSING DATA
x4) GENERATE WMF FROM PPT - OK
This button will change the chart data and will generate 4 WMF images in the template
folder. The difference with previous button is that before saving the pictures I CLONE the
presentation I have in memory (by saving it in a stream) and than open the saved on from the
stream (I would get the same result if I save it on disk and the open back from disk).
PROBLEMS --> look at the first IMAGE (dummy_wmf_OK0.wmf). The data of the first
column/Category is now perfect, texture in shapes is perfect, but I still miss
the texture in chart


I hope the sample and my explanation is clear
Best regards

Paolo Franceschini

Hi Paolo Franceschini,

Thanks for your feedback. I have observed the requirements and comments shared by you and will share my feedback for them independently.

paolo.franceschini:
1) License
thank you very much for your information. Your licence policies are perfectly clear for me. What I meant is the the client itself will buy it according with their need, and I still don’t know which one they will choose :wink:

I suggest you to please consult directly with our sales team in this regard for suitable license type. Your client may also consult our sales team directly as well for appropriate license type.


paolo.franceschini:

2) Protection
I will try your suggestion, but my doubt: since this feature is not supported by Powerpoint, what will happen when a user opens the “locked” presentation?


Presenation shapes protection is unique feature of Aspose.Slides that is unavailable in PowerPoint. When the user will open such presentation, he will not be able to select, alter or change the respective shape/shapes on which the locks are applied. There will be no issue when such presentation will be opened in PowerPoint.


paolo.franceschini:

x1) DOWNLOAD PPT
this will change the chart e stream the result in response.
PROBLEM --> save the resulting PPT. If I open it with PowerPoint 2013 I get an error that



I have been able to observe the presentation reapair message and issue with ID SLIDESNET-35436 has been created in our issue tracking system to investigate and resolve the issue.

paolo.franceschini:

x2) PREVIEW ONE SLIDE
This button will change the chart data, extract the first slide and stream it in HTML format
PROBLEM --> the original PPT has two shapes and a series of the chart filled with a texture.
The resulting html is missing the texture in the chart (replaced by a dark yellow


I have been able to observe the missing pattern inside chart and ID SLIDESNET-35437 has been created in our issue tracking system to investigate and resolve the issue.


paolo.franceschini:

x3) GENERATE WMF FROM PPT - KO
This button will change the chart data and will generate 4 WMF images in the template
folder.
PROBLEMS --> Look at the first IMAGE (dummy_wmf_KO0.wmf), the texture in shapes.The more serous,
the first column (category), named CHANGED 2010, is MISSING DATA


I have observed the missing chart data in WMF image of slide 1. An issue with ID SLIDESNET-35438 has been created in our issue tracking system to further investigate and resolve the issue.

paolo.franceschini:

x3) GENERATE WMF FROM PPT - KO
This button will change the chart data and will generate 4 WMF images in the template
folder.
PROBLEMS --> Look at the first IMAGE (dummy_wmf_KO0.wmf), the texture in shapes
is perfect, the texture in chart is missing (only yellow color)
x4) GENERATE WMF FROM PPT - OK
This button will change the chart data and will generate 4 WMF images in the template
folder. The difference with previous button is that before saving the pictures I CLONE the
presentation I have in memory (by saving it in a stream) and than open the saved on from the
stream (I would get the same result if I save it on disk and the open back from disk).
PROBLEMS --> look at the first IMAGE (dummy_wmf_OK0.wmf). The data of the first
column/Category is now perfect, texture in shapes is perfect, but I still miss
the texture in chart


I have observed the missing texture in WMF images of slide 1. An issue with ID SLIDESNET-35439 has been created in our issue tracking system to further investigate and resolve the issue.


This thread has been linked with the issues so that you may be automatically notified once the issues will be resolved.

We are sorry for your inconvenience,

Thank you very much for your answers.

I’ll look forward for the solution to our issues.

I do not hide that out client is a bit perplexed… if those featured will not be fixed probably he will look for a different component.

I take this opportunity to report that the same issue with missing texture in charts there’s also using Aspose.Cells, when exporting images from an excel sheet (find my code at the end of this mail).

By the way: how can I export only a RANGE of cells, and not the entire sheet or sheet pages? Excel itself is able to generate a picture from a cells selection.

CODE:
//Create a new Workbook object
//Open a template excel file
Workbook book = new Workbook(Server.MapPath(@“templates\MT15 Energy.xlsx”));
//Get the first worksheet.
Worksheet sheet = book.Worksheets[“Slide 7”];
        <span style="color:#a6e22e;">sheet</span>.<span style="color:#a6e22e;">Cells</span>[<span style="color:#e6db74;">"C6"</span>].<span style="color:#a6e22e;">Value</span> = DateTime.<span style="color:#a6e22e;">Now</span>.<span style="color:#a6e22e;">ToString</span>();

        <span style="color:#a1a1a1;">//Define ImageOrPrintOptions</span>
        ImageOrPrintOptions <span style="color:#a6e22e;">imgOptions</span> = <span style="color:#66d9ef;">new</span> ImageOrPrintOptions();
        <span style="color:#a1a1a1;">//Specify the image format</span>
        <span style="color:#a6e22e;">imgOptions</span>.<span style="color:#a6e22e;">ImageFormat</span> = <span style="color:#a6e22e;">System</span>.<span style="color:#a6e22e;">Drawing</span>.<span style="color:#a6e22e;">Imaging</span>.ImageFormat.<span style="color:#a6e22e;">Jpeg</span>;
        <span style="color:#a6e22e;">imgOptions</span>.<span style="color:#a6e22e;">Quality</span> = <span style="color:#dadada;">100</span>;
        <span style="color:#a6e22e;">imgOptions</span>.<span style="color:#a6e22e;">VerticalResolution</span> = <span style="color:#dadada;">1000</span>;
        <span style="color:#a6e22e;">imgOptions</span>.<span style="color:#a6e22e;">HorizontalResolution</span> = <span style="color:#dadada;">1000</span>;
        <span style="color:#a6e22e;">imgOptions</span>.<span style="color:#a6e22e;">OnePagePerSheet</span> = <span style="color:#66d9ef;">true</span>;

        <span style="color:#a1a1a1;">//Render the sheet with respect to specified image/print options</span>
        SheetRender <span style="color:#a6e22e;">sr</span> = <span style="color:#66d9ef;">new</span> SheetRender(<span style="color:#a6e22e;">sheet</span>, <span style="color:#a6e22e;">imgOptions</span>);

        <span style="color:#a1a1a1;">//Render the image for the sheet</span>
        Bitmap <span style="color:#a6e22e;">bmp</span> = <span style="color:#a6e22e;">sr</span>.<span style="color:#a6e22e;">ToImage</span>(<span style="color:#dadada;">0</span>);

        Bitmap <span style="color:#a6e22e;">thumb</span> = <span style="color:#66d9ef;">new</span> Bitmap(<span style="color:#dadada;">1200</span>, <span style="color:#dadada;">600</span>);

        Graphics <span style="color:#a6e22e;">gr</span> = Graphics.<span style="color:#a6e22e;">FromImage</span>(<span style="color:#a6e22e;">thumb</span>);

        <span style="color:#a6e22e;">gr</span>.<span style="color:#a6e22e;">DrawImage</span>(<span style="color:#a6e22e;">bmp</span>, <span style="color:#dadada;">0</span>, <span style="color:#dadada;">0</span>, <span style="color:#dadada;">1200</span>, <span style="color:#dadada;">600</span>);

        <span style="color:#a1a1a1;">//Save the image file</span>
        <span style="color:#a6e22e;">thumb</span>.<span style="color:#a6e22e;">Save</span>(<span style="color:#a6e22e;">Server</span>.<span style="color:#a6e22e;">MapPath</span>(<span style="color:#e6db74;">@"templates\SheetImage.jpg"</span>));</pre></div><div><br></div><div>Thanks again</div><div>Best Regards</div><div>Paolo</div><div><br></div>

Hi Paolo Franceschini,

We will try our best to resolve the incurrring issues ASAP. Our development team will when schedule the issue for investigation and resolution, I will then be able to share the further feedback in this regard.

For Aspose.Cells related issue, my fellow teammate will share his feedback shortly.

Many Thanks,

paolo.franceschini:

By the way: how can I export only a RANGE of cells, and not the entire sheet or sheet pages? Excel itself is able to generate a picture from a cells selection.


Hi Paolo Franceschini,

Thanks for your posting and using Aspose APIs.

You can take the image of your Range by setting the PrintArea and then setting the margins as 0. Please see the following code and check the source.xlsx (attached) file used in it. The code is taking the image of the range E8:H15.

I have also attached the output image generated by the code for your reference.

C#
string filePath = @"F:\Shak-Data-RW\Downloads\source.xlsx";

Workbook workbook = new Workbook(filePath);
Worksheet worksheet = workbook.Worksheets[0];

worksheet.PageSetup.PrintArea = "E8:H15";
worksheet.PageSetup.LeftMargin = 0;
worksheet.PageSetup.RightMargin = 0;
worksheet.PageSetup.TopMargin = 0;
worksheet.PageSetup.BottomMargin = 0;

ImageOrPrintOptions options = new ImageOrPrintOptions();
options.OnePagePerSheet = true;
options.ImageFormat = ImageFormat.Jpeg;

SheetRender sr = new SheetRender(worksheet, options);
sr.ToImage(0, filePath + ".out.jpg");

Hi


thank you for your quick reply, and thanx again for the sample code you posted.
It’s as simple as that! Perfect!

:wink:

Hi Paolo Franceschini,

Thanks for your posting and using Aspose APIs.

It is good to know that given sample code was helpful for you. Let us know if you encounter any other issue, we will be glad to look into it and help you further.

Hi Team,

I am not sure whether my problem is same as SLIDESNET-35439.
I use Aspose.Slides 16.7.0.0 and code like:
series.Format.Fill.FillType = FillType.Pattern;
series.Format.Fill.PatternFormat.PatternStyle = PatternStyle.Cross;
and the bars are all black.

Should I be able to set the look of the bars to Cross or this bug affects also saving the whole presentation?

Regards
Adam

Hi Aspose Team,

I need to have pattern in bars of the Stacked Column chart. I will share my observations.
My code takes a ppt file (let’s call it template file), does some changes and then saves it to file (let’s call it generated file). If in the template file, the chart has already bars set as pattern (Format Data Series/Fill/Patter Fill/WideDownwardDiagonal)
AND
in the code I have something like:
fillFormat.FillType = FillType.Pattern;
fillFormat.PatternFormat.PatternStyle = PatternStyle.WideDownwardDiagonal;

then I can see pattern on bars in the chart, after saving it as generated file. So looks like it must be set the same in the template file (manually) and the same in code. But when I see the quality of this pattern on the chart in generated file, it looks like it would be made up of big 1mm pixels. Can you reproduce this issue?

Regards
Adam

@AdamGr,

I have observed your comments and have not been able to understand the requirements. Can you please share the source file with desired chart that you want to generate using Aspose.Slides along with sample project used.