Need full vb script to generate PPT and make it downloadable on client side - I'm using asp.net VS2010.
10Q!
Presentation.SaveToHttpResponse(string FileName, FileFormat fileFormat, System.Web.HttpResponse response);
byte[] data= null;
using (MemoryStream ms = new MemoryStream())
{
presentation.SaveToFile(ms, FileFormat.Pptx2010);
data = ms.ToArray();
}
Response.Clear();
Response.AddHeader("Content-Type", "application/vnd.openxmlformats-officedocument.presentationml.presentation");
Response.AddHeader("Content-Disposition", "attachment;filename=sample.pptx");
Response.OutputStream.Write(data, 0, data.Length);
Response.End();
Presentation presentation = new Presentation();
RectangleF rectangle = new RectangleF(0, 50, 200, 50);
//3. Set the text range size in a slide by setting height of width of rectangle
IAutoShape shape = presentation.Slides[0].Shapes.AppendShape(ShapeType.Rectangle,rectangle);
shape.ShapeStyle.LineColor.Color = Color.White;
shape.Fill.FillType = Spire.Presentation.Drawing.FillFormatType.None;
shape.AppendTextFrame("Hello World!");
TextRange textRange = shape.TextFrame.TextRange;
textRange.Fill.FillType = Spire.Presentation.Drawing.FillFormatType.Solid;
textRange.Fill.SolidColor.Color = Color.Black;
//1. Set the font type
textRange.LatinFont = new TextFont("Arial Black");
//2. Set the font size
textRange.Format.FontHeight = 20;
//4. Set "wrap text"
shape.TextFrame.WordWrap = true;
//5. Set text left indent
shape.TextFrame.MarginLeft = 60;
presentation.SaveToFile("sample.pptx",FileFormat.Pptx2010);
The Set text left indent does not work - the text in centralized.
string fontname=this.dropDownListFonts.SelectedItem.ToString();
textRange.LatinFont = new TextFont(fontname);