I have to create a report and print it in word and excel with the following requirement:
1: The first page has some hi-res images e.g. some different geometric shapes with text in it. The location of the image(16 images in total ) on the page will be static, however the fill color of image can be either green or grey.E.g. one box can be green for one user , for other it can be grey etc.
2: the second page of the report will be data from a DB and will formatted as a content tree structure.
I am planning to use ASPOSE for this.
I am planning to create a template with superimposed images, e.g. green filled image and grey filled image superimposed on each other .Depending on the selection made by the user at runtime, I want to "Send to Back" or "Bring to Front." Can I change the "Send to Back" or "Bring to Front" properties at runtime depending on parameters passed to the report?
Also, I need to make sure that the template approach will not lead to issues when multiple user try to generate the report.
Also, I want the image path to be configurable, so that when business wants to change the text or color of the image, I do not need to redeploy the code. I can just change the image.
I am not very clear about your requirement. Are you interested in generating Word and Excel files with images? Or you are looking for a feature to convert PPT file to Word and Excel format? Please share some more details and some sample of your requirements with us so we can assist you in a better way.
Please see the updated question below. Will appreciate a response asap.
I have to create a report and print it in PPT with the following requirement:
1: The first page has some hi-res images e.g. some different geometric shapes with text in it. The location of the image(16 images in total ) on the page will be static, however the fill color of image can be either green or grey.E.g. one box can be green for one user , for other it can be grey etc.
2: the second page of the report will be data from a DB and will formatted as a content tree structure.
I am planning to use ASPOSE for this.
I am planning to create a template with the images or shapes, pre existing , with superimposed images, e.g. green filled image and grey filled image superimposed on each other .Depending on the selection made by the user at runtime, I want to āSend to Backā or āBring to Front.ā Can I change the āSend to Backā or āBring to Frontā properties at runtime depending on parameters passed to the report?
Also, I need to make sure that the template approach will not lead to issues when multiple user try to generate the report.
Also, I want the image path to be configurable, so that when business wants to change the text or color of the image, I do not need to redeploy the code. I can just change the image.
Please see the updated question below. Will appreciate a response asap.
1: The first page has some hi-res images e.g. some different geometric shapes with text in it. The location of the image(16 images in total ) on the page will be static, however the fill color of image can be either green or grey.E.g. one box can be green for one user , for other it can be grey etc.
Please see the following documentation link with details regarding how to work with shapes and pictures using Aspose.Slides for .NET.
rachanadikshit@hotmail.com:
2: the second page of the report will be data from a DB and will formatted as a content tree structure.
I am not sure regarding your above requirement. Please share some sample presentation file (creating manually) to show the required feature.
rachanadikshit@hotmail.com:
I am planning to create a template with the images or shapes, pre existing , with superimposed images, e.g. green filled image and grey filled image superimposed on each other .Depending on the selection made by the user at runtime, I want to āSend to Backā or āBring to Front.ā Can I change the āSend to Backā or āBring to Frontā properties at runtime depending on parameters passed to the report?
The IShapeCollection class exposes Reorder() method to set the order of shapes in a slide. Please see the following sample code for your reference:
//Instantiate Prseetation class that represents the PPTX
using (Presentation pres = new Presentation())
{
//Get the first slide
ISlide sld = pres.Slides[0];
//Add autoshapes of rectangle type
IAutoShape shp = sld.Shapes.AddAutoShape(Aspose.Slides.ShapeType.Rectangle, 50, 150, 150, 50);
IAutoShape shp2 = sld.Shapes.AddAutoShape(Aspose.Slides.ShapeType.Rectangle, 70, 170, 170, 70);
//Get all shapes in a slide
IShapeCollection collection = sld.Shapes;
//Set order -- in the below case Shape2 will be on top of shape one
//Change the first parameter "index" to 0 and Shape2 will be at bottom.
collection.Reorder(1, shp2);
//Write the PPTX file to disk
pres.Write("c:\\data\\RectShp1.pptx");
}
rachanadikshit@hotmail.com:
Also, I need to make sure that the template approach will not lead to issues when multiple user try to generate the report.
Well, it depends on how you are handling the userās interaction in your application. In case you have any specific concern regarding this, please share and we will be happy to assist you accordingly.
rachanadikshit@hotmail.com:
Also, I want the image path to be configurable, so that when business wants to change the text or color of the image, I do not need to redeploy the code. I can just change the image.
Well, I am afraid, this is not possible as Pictures / images are embedded in the presentation file and are not linked with the source. However, in your application you can implement the logic to update an image in your presentation file. Please see the following sample code for reference.
//Accessing the presentation
Presentation pres = new Presentation(path + "RectShpPic.pptx");
ISlide sl;
for (int i = 0; i < pres.Slides.Count; i++)
{
sl = pres.Slides[i];
for (int j = 0; j < sl.Shapes.Count; j++)
{
// Accessing the shape with picture
Aspose.Slides.IShape sh = sl.Shapes[j];
//Getting the fill type of the shape
FillType fillType = sh.FillFormat.FillType;
//If the fill type of shape is picture
if (fillType == FillType.Picture)
{
//Set the picture
System.Drawing.Image img = (System.Drawing.Image)new Bitmap(path + "logo.jpg");
IPPImage imgx = pres.Images.AddImage(img);
sh.FillFormat.PictureFillFormat.Picture.Image = imgx;
}
}
}
pres.Write(path + "ChangedPic.ppt");
Please feel free to contact support in case you need any further assistance.
Thank you for your response. I am also considering another approach. Instead of a static image, I am planning to use ASPOSE for generating PPT from templates . The template will have custom geometric shapes (16 custom shapes arranged at specific positions on the page). Each shape will have text that will be filled with data from DB.The background color of the shapes can be controlled at runtime too. The position of the shapes is really important as it should look just the way my web UI looks.
Q: I wanted to make sure that there will be no performance issue if i use this approach and multiple users are trying to print simultaneously using the same template. Please confirm.
Also, I have to generate the same report , with same data format and text etc in PPT too.
Q: Please confirm the performance issue for those two as well.
Q: Do I need to create the template for both word and PPT , or is there a better approach , i.e. convert the word page to image and place it on PPT?
Q: Will I need aspose excel and aspose PPT for this purpose?
note: The shapes will not necessarily be standard shapes like rectangles etc, it ca be a complicated shape.
Please see the following thread which contains the reply to all your queries related to different products. https://forum.aspose.com/t/19882%3C/font%3E%3C/a%3E%3Co:p%3E%3C/o:p%3E%3C/span%3E%3C/p%3E%3Cp%20style=
Ok. ALso the shapes that I need on my template will not be the standard shapes like rectangle etc.
If I create these shapes on my word template, can aspose recognize these shapes at runtime? Is there a content control kind of concept that I can use here?
ALso, coming back to the performance issues using template.Please respond to the question
Ok. ALso the shapes that I need on my template will not be the standard shapes like rectangle etc.
If I create these shapes on my word template, can aspose recognize these shapes at runtime? Is there a content control kind of concept that I can use here?
Well, I am afraid Aspose.Words and Aspose.Slides have different object models and object (shapes) from one API cannot be recognized by other API at runtime. You will need to convert such shapes to images and add them to presentation.
bluefalcon.7691:
ALso, coming back to the performance issues using template. Please respond to the question
Performance is totally dependent on you implementation. If you are using a multi-threaded application and different (copies) of the same template are used, I think there wonāt be much performance implications in that case. However, again, it depends on your implementation and the contents of your reports.
I suggest you to please try using following sample code on your end to serve the purpose. I have also attached source image as well as generated presentation for your reference as well.
public static void AddTextandImage()
{
String path = @"C:\Aspose Data\";
Presentation pres = new Presentation();
ISlide slide = pres.Slides[0];
IAutoShape ashp = slide.Shapes.AddAutoShape(ShapeType.Rectangle, 0, 0, 200, 50);
System.Drawing.Image img = (System.Drawing.Image)new Bitmap(@"C:\Users\Public\Pictures\Sample Pictures\Jellyfish.jpg");
IPPImage imgx = pres.Images.AddImage(img);
ashp.FillFormat.FillType = FillType.Picture;
ashp.FillFormat.PictureFillFormat.Picture.Image = imgx;
ITextFrame text=ashp.AddTextFrame("");
text.Paragraphs[0].Portions[0].Text = "Sample text";
//if there are multiple shapes i.e One with text and other with image
//You can then set shape order to set the shapes behind or infront
//Bring to front
slide.Shapes.Reorder(slide.Shapes.Count - 1, ashp);
//send to back
slide.Shapes.Reorder(0, ashp);
pres.Save("C:\\Aspose Data\\Saved.pptx", Aspose.Slides.Export.SaveFormat.Pptx);
}