In Section of type - Table of Contents- Margin.Right does not behave like Margin.Left

Hi,

In Table of Contents, Margin.Right does not behave like Margin.Left i.e. Margin.Left puts up an indent from Left but similar does not happen in Margin.Right.

Moreover, both Margin Supported are not supported together.

We have requirement for both the Margins supported together i.e. Left as well as Right Margin.

With regards,

Rajat

Hi Rajat,

Please share the complete code snippet which you’re using at your end to create the PDF file, so we could investigate the issue at our end. You’ll be updated with the results accordingly.

We’re sorry for the inconvenience.
Regards,

Hi Shahzad,

Please find the enclosed code , Result O/p and expected Result:

Code

//Instantiate Pdf instance by calling its empty constructor

Aspose.Pdf.Generator.Pdf pdf1 = new Aspose.Pdf.Generator.Pdf();

pdf1.IsBookmarked = true;

//Create a list section

Aspose.Pdf.Generator.ListSection tocSection = new Aspose.Pdf.Generator.ListSection("Table Of Contents");

//Set its list type as table of of contents

tocSection.ListType = Aspose.Pdf.Generator.ListType.TableOfContents;

//Add the list section to the sections collection of the Pdf document

pdf1.Sections.Add(tocSection);

//Define the format of the four levels list by setting the left margins and

//text format settings of each level

tocSection.ListFormatArray.Length = 4;

tocSection.ListFormatArray[0].Margin.Right = 0;

tocSection.ListFormatArray[0].TextInfo.IsTrueTypeFontBold = true;

tocSection.ListFormatArray[0].TextInfo.IsTrueTypeFontItalic = true;

tocSection.ListFormatArray[1].Margin.Left = 30;

tocSection.ListFormatArray[1].TextInfo.IsUnderline = true;

tocSection.ListFormatArray[1].TextInfo.FontSize = 10;

tocSection.ListFormatArray[2].Margin.Right = 20;

tocSection.ListFormatArray[2].TextInfo.IsTrueTypeFontBold = true;

tocSection.ListFormatArray[3].Margin.Right = 30;

tocSection.ListFormatArray[3].TextInfo.IsTrueTypeFontBold = true;

//Create a section in the Pdf document

Aspose.Pdf.Generator.Section sec1 = pdf1.Sections.Add();

//Add four headings in the section

for (int Level = 1; Level != 5; Level++)

{

Aspose.Pdf.Generator.Heading heading2 = new Aspose.Pdf.Generator.Heading(pdf1, sec1, Level);

Aspose.Pdf.Generator.Segment segment2 = new Aspose.Pdf.Generator.Segment(heading2);

heading2.TOC = tocSection;

heading2.Segments.Add(segment2);

heading2.IsAutoSequence = true;

segment2.Content = "this is heading of level ";

segment2.Content += Level.ToString();

//Add the heading into Table Of Contents.

heading2.IsInList = true;

sec1.Paragraphs.Add(heading2);

}

Result:

1 this is heading of level 1.......................................0
1.1 this is heading of level 2....................................................0
1.1.1 this is heading of level 3..................................0
1.1.1.1 this is heading of level 4...............................0
3 this is heading of level 1........................................0
3.1 this is heading of level 2.....................................................0
3.1.1 this is heading of level 3...................................0
3.1.1.1 this is heading of level 4................................0

Expected Result:

Result: i.e. Both Side Margins together

1 this is heading of level 1...............................................................0
1.1 this is heading of level 2........................................0
1.2 this is heading of level 4........................................0
3 this is heading of level 1...............................................................0
3.1 this is heading of level 2........................................0

With regards,

Rajat

Hi Shehzad,

Did you looked into this issue? Any ideas by when I can expect any resolution or alternative way for achieving this?

Rajat

Hello Rajat,

Thanks for sharing the code snippet and sorry for replying you late.<span style=“font-size:10.0pt;font-family:“Arial”,“sans-serif””>

I
have tested the scenario and I am able to reproduce the same problem. For the
sake of correction, I have logged it in our issue tracking system as PDFNEWNET-30315. We will investigate this
issue in details and will keep you updated on the status of a correction.<span style=“font-size:10.0pt;font-family:“Arial”,“sans-serif””><span style=“font-size:10.0pt;
font-family:“Arial”,“sans-serif””>

We apologize for your inconvenience.