Spire.Presentation is a professional PowerPoint® compatible library that enables developers to create, read, write, modify, convert and Print PowerPoint documents. Get free and professional technical support for Spire.Presentation for .NET, Java, Android, C++, Python.

Thu Nov 21, 2024 3:07 am

foreach (Section section in doc.Sections)
{
foreach (Paragraph paragraph in section.Paragraphs)
{
paragraph.Format.BeforeSpacing = 0;
paragraph.Format.AfterAutoSpacing = false;
paragraph.Format.AfterSpacing = 0;
paragraph.Format.BeforeAutoSpacing = false;
paragraph.Format.HorizontalAlignment = HorizontalAlignment.Justify;

}

foreach (DocumentObject obj in section.Body.ChildObjects)
{
if (obj is Paragraph)
{
var para = obj as Paragraph;
foreach (DocumentObject Pobj in para.ChildObjects)
{

if (Pobj is TextRange)
{
TextRange textRange = Pobj as TextRange;
textRange.CharacterFormat.FontName = "Calibri";
textRange.CharacterFormat.FontSize = 10;
}
}
}
}
foreach (Spire.Doc.Table table in section.Tables)
{
foreach (Spire.Doc.TableRow row in table.Rows)
{
foreach (Spire.Doc.TableCell cell in row.Cells)
{

foreach (Paragraph p in cell.Paragraphs)
{
foreach (DocumentObject Pobj in p.ChildObjects)
{
if (Pobj is TextRange)
{
TextRange textRange = Pobj as TextRange;
textRange.CharacterFormat.FontName = "Calibri";
textRange.CharacterFormat.FontSize = 10;
}
}
p.Format.BeforeSpacing = 0;
p.Format.AfterAutoSpacing = false;
p.Format.AfterSpacing = 0;
p.Format.BeforeAutoSpacing = false;
p.Format.HorizontalAlignment = HorizontalAlignment.Justify;
}
}

}
}

foreach (DocumentObject obj in header.ChildObjects)
{
section.HeadersFooters.Header.ChildObjects.Add(obj.Clone());
}
foreach (DocumentObject obj in footer.ChildObjects)
{
section.HeadersFooters.Footer.ChildObjects.Add(obj.Clone());
}
}

Premchander
 
Posts: 1
Joined: Thu Nov 21, 2024 3:03 am

Thu Nov 21, 2024 9:16 am

Hello,

Thank you for your inquiry.
Are you testing with our latest version of Spire.Doc 12.11.7? If not, please use the latest version for testing as it contains more fixes. If you still encounter this issue in the latest version, please provide us with the test file for us to verify your problem. Thank you very much!

nuget Download:
https://www.nuget.org/packages/Spire.Docfor.NETStandard/12.11.7
https://www.nuget.org/packages/Spire.Doc/12.11.7

Sincerely,
Doris
E-iceblue support team
User avatar

Doris.Liu
 
Posts: 406
Joined: Mon Nov 07, 2022 8:10 am

Return to Spire.Presentation