Hi Team,
I wanted to make a ppt using shapes.
When I am downloading the ppt, the left pane for navigating slides(portion titled as thumbnails at the left) is taking more than half of the window.
I went through some blogs. It says i can use showleftPane property to achieve my goal.But I was unable to figure out how to use it. Can you help me in this??
I am using .Net 4.0 and aspose.slides 18.5.Below is my code for reference.
using Aspose.Slides;
using Aspose.Slides.SmartArt;
namespace SlideGenerator
{
class Program
{
static void Main(string[] args)
{
onScreenOrgChartWOHPPT(“Portrait”);
}
public static void onScreenOrgChartWOHPPT(string orinetation)
{
try
{
Aspose.Slides.License licenseslide = new Aspose.Slides.License();
Presentation pres = new Presentation();
// pres.NotesSize.Size = new System.Drawing.SizeF(10F, 10F);
ISlide sld = pres.Slides[0];
// ISaveOptions objSave = new ISaveOptions();
// Add an AutoShape of Rectangle type
IAutoShape ashp = sld.Shapes.AddAutoShape(Aspose.Slides.ShapeType.Rectangle, 110, 75, 500, 50);
ashp.FillFormat.FillType = FillType.NoFill;
ashp.LineFormat.FillFormat.FillType = FillType.NoFill;
// Add TextFrame to the Rectangle
ashp.AddTextFrame(" ");
// Accessing the text frame
ITextFrame txtFrame = ashp.TextFrame;
// Create the Paragraph object for text frame
IParagraph para = txtFrame.Paragraphs[0];
// Create Portion object for paragraph
IPortion portion = para.Portions[0];
// Set Text
portion.Text = "Org Chart";
//portion.Text.PadLeft(0);
portion.PortionFormat.FillFormat.FillType = FillType.Solid;
portion.PortionFormat.FillFormat.SolidFillColor.Color = System.Drawing.Color.DarkBlue;
portion.PortionFormat.FontBold = NullableBool.True;
#region smart art
//Add Smart Art- Organizational Chart
ISmartArt smart = sld.Shapes.AddSmartArt(60, 80, 600, 400, SmartArtLayoutType.OrganizationChart);
//Adding style to Smart Art
smart.ColorStyle = SmartArtColorType.ColoredOutlineAccent1;
smart.FillFormat.FillType = FillType.NoFill;
//create ISmartArtNode objet
ISmartArtNode node = smart.AllNodes[0];
//Add text to parent node
node.TextFrame.Text = "Parent Name";
SmartArtNode chNode2 = (SmartArtNode)node.ChildNodes[0];
//remove Zeroth child node from organizational chart
smart.AllNodes.RemoveNode(chNode2);
int varchildcount = 13;
int position = 0;
for(int i = 0; i<13; i++)
{
int indexNode = 2;
if (node.ChildNodes.Count < varchildcount)
{
//add nodes
int diff = varchildcount - node.ChildNodes.Count;
for (int val = 0; val < diff; val++)
{
int x = val < 5 ? 2 : 3;
SmartArtNode chNodenew = (SmartArtNode)((SmartArtNodeCollection)node.ChildNodes).AddNodeByPosition(x);
}
}
else if (node.ChildNodes.Count > varchildcount)
{
int diff = node.ChildNodes.Count - varchildcount;
//remove nodes
for (int val = node.ChildNodes.Count; val > varchildcount; val--)
{
SmartArtNode chNodeDel = (SmartArtNode)node.ChildNodes[indexNode];
smart.AllNodes.RemoveNode(chNodeDel);
indexNode--;
}
smart.X = 125;
smart.Y = 175;
smart.Width = 500;
smart.Height = 200;
}
////add nodes
//int diff = varchildcount - node.ChildNodes.Count;
//for (int val = 0; val < diff; val++)
//{
// SmartArtNode chNodenew = (SmartArtNode)((SmartArtNodeCollection)node.ChildNodes).AddNode();
//}
SmartArtNode chNode = (SmartArtNode)node.ChildNodes[position];
//string nameChild = name["FullName"].ToString() + "#" + name["Title"].ToString();
//nameChild = nameChild.Replace("#", "\n");
chNode.TextFrame.Text = "Name 123";
position++;
}
#endregion
//MemoryStream ms = new MemoryStream();
string filePath = @"G:\OrgChart.pptx";
pres.Save(filePath, Aspose.Slides.Export.SaveFormat.Pptx);
}
catch (Exception ex)
{
Console.WriteLine(ex.Message);
}
}
}
}