Unable to hide leftPane in generated PPT


#1

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);
        }

    }
}

}


#2

@rimadas,

I have observed your requirements and suggest you to please try using following sample code to set the presentation viewing options that are available in PowerPoint as well.

public static void TestView()
{
    Presentation pres = new Presentation();
    pres.ViewProperties.LastView = Aspose.Slides.ViewType.SlideSorterView;
 //   pres.ViewProperties.SlideViewProperties.
  //  pres.ViewProperties.SlideViewProperties.Scale = 100;
    pres.Save("C:\\Aspose Data\\TestView.pptx", Aspose.Slides.Export.SaveFormat.Pptx);
}

Please visit this API link for possible view type options.


#3

Hi mudassir,
Thank you for the help.
It is working but i want to make the side in maximum size in lanscape view. So I have set a size for it. It seems the viewpropertries doesn’t work when the size of the silde is set manually. I will attach the changed code below.

 **pres.SlideSize.SetSize(1120, 630, SlideSizeScaleType.Maximize);** this is the properties  I have included.

Can you suggest any other properties to manipulate the thumbnail properties?

using Aspose.Slides;
using Aspose.Slides.SmartArt;
using System;
using Aspose.Slides.Export;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

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);
           pres.SlideSize.SetSize(1120, 630, SlideSizeScaleType.Maximize);
            pres.ViewProperties.LastView = Aspose.Slides.ViewType.OutlineView;
            //pres.ViewProperties= ViewType.SlideSorterView;
            ISlide sld = pres.Slides[0];
            //  pres.DocumentProperties.
            //    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);
        }

    }
}

}
strong text


#4

@rimadas,

I have observed the information shared by you and have not been able to completely understand the requirements. I request you to share the source presentation and desired output that you want to generate using Aspose.Slides. I shall investigate the requirements on my end to help you further.


#5

Hi,

I have attached the result here. it is a pptx file.

And the desired result is in the image.png file.

I want to deduce the size of navigation panel at the left side.

OrgChart.zip (37.5 KB)

image.png (69.7 KB)


#6

@rimadas,

I have observed your requirements and you are probably looking to achieve the attached presentation using Aspose.Slides. If this is your requirement, I regret to share that this is not possible using Aspose.Slides at the moment. An issue with ID SLIDESNET-40237 has been created in our issue tracking system to provide requested support. This thread has been linked with the issue so that you may be notified once the support will be available.

OrgChart_desired Result.zip (52.3 KB)


#7

This issue is affecting me, as well. What is the status of that SLIDESNET ticket?


#8

@justinlindh,

I regret to share that the issue is still unresolved. We request for your patience in this regard and will share updates with you as soon as the issue will be fixed.


#9

The issues you have found earlier (filed as SLIDESNET-40237) have been fixed in this update.