Aspose.Slides for .NET 26.9.0 Upgrade Reduces Spacing Between Text

Correct alignment-
image.png (12.3 KB)

Alignment after upgrade-
image.png (12.6 KB)

@mayurih,
Thank you for reporting the issue.

To investigate the reduced text spacing after upgrading to Aspose.Slides for .NET 26.9.0, please provide the following:

  • The source presentation file.
  • A minimal code example that reproduces the issue.
  • The Aspose.Slides version you were using before upgrading to 26.9.0, where the text spacing was rendered correctly.
  • The output files generated with both versions, if available.

This information will help us reproduce and investigate the issue on our side.

  1. i am not able to attach pptx in this forum
  string TopHeader = helper.GetLabelTranslation("Z10_LeadAuditorRecommendation");
  string Part2Heading = helper.GetLabelTranslation("Z10_OtherOrAdditionalLeadAuditorRecommendation");
  Part2Heading = Part2Heading.ToUpper();
  string Part2Answer = "";

  ASRQuestion asrQuestion = vm.Zone11.Zone11VM;
  List<ASRQuestion> asrQuestion2 = vm.Zone10.LeadAuditorRecommendation;
  bool hasMappedLA = asrQuestion2.Exists(con => con.IsMapped);
  bool hasMappedOtherAdditionalLA = asrQuestion.IsMapped;

  if (hasMappedLA || hasMappedOtherAdditionalLA)
  {
      destPres.Slides.InsertClone(inum, srcPres.Slides[28]);
      ITextFrame[] tbSlide26 = SlideUtil.GetAllTextBoxes(destPres.Slides[inum]);
      List<string> Slide26FindTexts = new List<string>() { "&Leadauditorrecommendation&", "&LADATA&" };

      //replace &Leadauditorrecommendation&
      foreach (Aspose.Slides.Paragraph para in tbSlide26[0].Paragraphs)
          foreach (Portion port in para.Portions)
              //Find text to be replaced
              if (port.Text.Contains(Slide26FindTexts[0]))
              //Replace exisitng text with the new text
              {
                  string str = port.Text;
                  int idx = str.IndexOf(Slide26FindTexts[0]);
                  string strStartText = str.Substring(0, idx);
                  string strEndText = str.Substring(idx + Slide26FindTexts[0].Length, str.Length - 1 - (idx + Slide26FindTexts[0].Length - 1));
                  port.Text = strStartText + TopHeader + strEndText;
              }
      //replace &LAData&
      foreach (Aspose.Slides.Paragraph para in tbSlide26[1].Paragraphs)
          foreach (Portion port in para.Portions)
              if (port.Text.Contains(Slide26FindTexts[1]))
              //Replace exisitng text with the new text
              {
                  string str = port.Text;
                  int idx = str.IndexOf(Slide26FindTexts[1]);
                  string strStartText = str.Substring(0, idx);
                  string strEndText = str.Substring(idx + Slide26FindTexts[1].Length, str.Length - 1 - (idx + Slide26FindTexts[1].Length - 1));
                  port.Text = strStartText + "" + strEndText;
              }

      List<AllTranslationOfOneLanguage> translations = vm.Translations;
      if (asrQuestion2.Count > 0)
      {
          foreach (var question in asrQuestion2)
          {
              if (string.IsNullOrEmpty(question.StandardText))
              {
                  continue;
              }
              string Part1Heading = "";
              string Part1Answer = "";

              string recommendation = string.Format("Lead Auditor Recommendation for {0}", question.StandardText);
              AllTranslationOfOneLanguage recommendationStandard = translations.Find(l => l.StandardText == recommendation);
              string recommendationText = recommendationStandard == null ? recommendation : recommendationStandard.Translation;
              //translate standardtext
              question.StandardText = recommendationText.ToUpper();


              bool hasMapped = asrQuestion2.Exists(con => con.IsMapped);

              if (hasMapped)
              {
                  Part1Heading = question.StandardText;
                  Part1Answer = question.AnswerTranslationValue;
              }
              tbSlide26[1].TextFrameFormat.AutofitType = TextAutofitType.Normal;
              tbSlide26[1].Paragraphs.AddFromHtml("<p style='font-size:20px !important; color:#FFC700; font-weight:bold; font-family:Calibri;'>" + Part1Heading + "</p><p style='font-size:20px !important; font-family:Calibri;'>" + Part1Answer + "</p>");
          }

      }

      if (!string.IsNullOrEmpty(asrQuestion.AnswerTranslationValue))
      {
          if (asrQuestion.AnswerTranslationValue.StartsWith("<p>"))
          {
              asrQuestion.AnswerTranslationValue = asrQuestion.AnswerTranslationValue.Substring(3);
              asrQuestion.AnswerTranslationValue = asrQuestion.AnswerTranslationValue.Replace("</p>", "");
          }
          Part2Answer = asrQuestion.AnswerTranslationValue;

          if (!string.IsNullOrEmpty(Part2Answer))
          {
              tbSlide26[1].TextFrameFormat.AutofitType = TextAutofitType.Normal;
              tbSlide26[1].Paragraphs.AddFromHtml("<p style='font-size:20px !important; text-transform: UPPERCASE !important; color:#FFC700; font-weight:bold; font-family:Calibri; '>" + Part2Heading + "</p><p style='font-size:20px !important; font-family:Calibri;'>" + Part2Answer + "</p>");

          }
      }
      else
      {
          tbSlide26[1].TextFrameFormat.AutofitType = TextAutofitType.Normal;
          tbSlide26[1].Paragraphs.AddFromHtml("<p style='font-size:20px !important; text-transform: UPPERCASE !important; color:#FFC700; font-weight:bold; font-family:Calibri; '>" + Part2Heading + "</p><p style='font-size:20px !important; font-family:Calibri;'>" + Part2Answer + "</p>");

      }

      inum++;
  }
  1. i was using Aspose.Slides for .NET 20.6
  2. can not attach

@mayurih,
Thank you for providing the code example and confirming that the issue did not occur with Aspose.Slides for .NET 20.6.

To reproduce and investigate the issue accurately, we still need the source presentation and, if possible, the output presentations generated with versions 20.6 and 26.9.

Please compress the files into a ZIP archive and attach the ZIP file here. Please also remove any sensitive information from the files if necessary.

Once we have the presentation files, we will investigate the difference in text spacing between the two versions.

DemoPPT.zip (723.8 KB)

@mayurih,
Thank you for the sample presentation file. I have reproduced the problem where the text spacing is reduced after upgrading Aspose.Slides from version 20.6 to 26.9. We apologize for any inconvenience caused.

We have opened the following new ticket(s) in our internal issue tracking system and will deliver their fixes according to the terms mentioned in Free Support Policies.

Issue ID(s): SLIDESNET-45545

You can obtain Paid Support Services if you need support on a priority basis, along with the direct access to our Paid Support management team.

Note: The behavior in Aspose.Slides 26.9 may actually be correct, while the spacing produced by version 20.6 may have been inaccurate. This still needs to be verified against PowerPoint’s rendering and the source formatting.

Any update on this

@mayurih,
Thank you for following up.

There is no update on the issue at the moment. The ticket SLIDESNET-45545 is still open and under investigation. We will let you know as soon as we have any new information or progress to share.

Hi , We have purchansed license do we also get paid support?

@mayurih,
Yes, your Aspose license includes free technical support.

However, Paid Support is a separate service and is not included with the product license. If you need higher-priority support, you can purchase a Paid Support subscription separately.

You can find more information here:
Purchase Paid Support - Purchase - aspose.com

is there any other way we can fix the issue but adding some code or updating ppt file?

@mayurih,
While the issue is still under investigation, you can try a couple of workarounds.

First, your code uses TextAutofitType.Normal, which allows PowerPoint to reduce the font size and line spacing to fit the text within the shape. Try changing it to TextAutofitType.None:

tbSlide26[1].TextFrameFormat.AutofitType = TextAutofitType.None;

Please note that disabling AutoFit may cause the text to extend beyond the shape boundaries.

Another option is to explicitly adjust the paragraph spacing after adding the HTML content:

foreach (IParagraph paragraph in tbSlide26[1].Paragraphs)
{
    paragraph.ParagraphFormat.SpaceAfter = -10;
}

In this example, -10 specifies 10 points of spacing after each paragraph. You can adjust this value to achieve the desired layout.

For more information, see the ParagraphFormat API Reference.

Please note that these are potential workarounds, not confirmed fixes for SLIDESNET-45545. We cannot yet guarantee that they will reproduce the spacing generated by version 20.6.

If neither approach helps, please let us know. We will continue investigating the issue.