Hello,
When We generate presentation and fill data in textbox shape, data gets overflow in shape. we have set “Shrnk text on overflow” property in base template from where we are generating slides. please suggest solution for that.
Please find Image attached.
Overflowissue.png (26.2 KB)
Thanks,
@sdtechsupport.sirius,
I have observed your requirements and like to share that you can set the TextAutofitType enumerator value to Normal while setting TextFrame.TextFrameFormat.Autofit property. I hope the shared information will be helpful.
Thanks for quick response.
I have tried with the code.
shape = FindShape(Slide, “Description” + tempIndex);
if (shape != null)
{
string str = ((IAutoShape)shape).TextFrame.Text;
if (((IAutoShape)shape).TextFrame.Text != "")
{
if (item != null)
{
if (!string.IsNullOrEmpty(item.TermNotes))
{
str = str.Replace("<Description_" + tempIndex + ">", WebUtility.HtmlDecode(Regex.Replace(item.TermNotes, "<.*?>", String.Empty)));
}
else
{
str = str.Replace("<Description_" + tempIndex + ">", "");
}
}
else
{
if (!string.IsNullOrEmpty(topicNames))
{
str = str.Replace("<Description_" + tempIndex + ">", topicNames);
}
else
{
str = str.Replace("<Description_" + tempIndex + ">", string.Empty);
}
}
}
((IAutoShape)shape).TextFrame.TextFrameFormat.AutofitType = TextAutofitType.Normal;
((IAutoShape)shape).TextFrame.Text = str;
but it didn’t work for me. please suggest is there any changes?
Thanks
@sdtechsupport.sirius,
I suggest you to please try using following sample code and make necessary changes in your application in accordance to it. Please also set text autofit type before populating text in text frame as well.
public static void TestAutofit()
{
using (Presentation pres = new Presentation())
{
// Access the presentation slide
ISlide slide = pres.Slides[0];
// Add Smart Art Shape
IAutoShape ashape = slide.Shapes.AddAutoShape(ShapeType.Rectangle, 0, 0, 100, 100);
ashape.TextFrame.TextFrameFormat.AutofitType = TextAutofitType.Normal;
ashape.AddTextFrame("");
ashape.TextFrame.Text = "THis is long long text, THis is long long text,THis is long long text,THis is long long text,THis is long long text,THis is long long text,THis is long long text,THis is long long text,THis is long long text,THis is long long text,THis is long long text,";
pres.Save("C:\\Aspose Data\\SimpleSmartArt_out.pptx", Aspose.Slides.Export.SaveFormat.Pptx);
}
}
I have implemented your changes but the behavior is same.not sure but assuming that you have added shape dynamically and in my case its already exist in template.
shape = FindShape(Slide, “Description” + tempIndex);
if (shape != null)
{
string str = ((IAutoShape)shape).TextFrame.Text;
if (((IAutoShape)shape).TextFrame.Text != "")
{
if (item != null)
{
if (!string.IsNullOrEmpty(item.TermNotes))
{
str = str.Replace("<Description_" + tempIndex + ">", WebUtility.HtmlDecode(Regex.Replace(item.TermNotes, "<.*?>", String.Empty)));
}
else
{
str = str.Replace("<Description_" + tempIndex + ">", "");
}
}
else
{
if (!string.IsNullOrEmpty(topicNames))
{
str = str.Replace("<Description_" + tempIndex + ">", topicNames);
}
else
{
str = str.Replace("<Description_" + tempIndex + ">", string.Empty);
}
}
}
((IAutoShape)shape).TextFrame.TextFrameFormat.AutofitType = TextAutofitType.Normal;
((IAutoShape)shape).AddTextFrame("");
((IAutoShape)shape).TextFrame.Text = str;
}
Please suggest.
Thanks,
@sdtechsupport.sirius,
If the suggested code is not helpful on your end then I request you to please share a working sample project that is reproducing issue on your end along with source presentation. Please share the requested information so that we may proceed further to help you out.
Hello,
As discussed please find the demo MVC application to reproduce the text overflow issue that we are facing.
SampleProject.zip (923.1 KB)
We have used Apose.slide version 15.11.0.0
As discussed attaching MVC demo project to replicate the issue. OverflowIssueimage.png (33.7 KB)
In the solution
- Folder “PresentationTemplate/ServiceOverviewReport_Template.aspx” contains Master template for the project.
- Folder “PresentationDownloads\Demo_Overview_Report.pptx” Dynamically generated presentation.
As discussed dynamically generated template we are facing overflow issue in case of longer text.
(shape highlighted screenshot)
Thanks.
@sdtechsupport.sirius,
Thank you for sharing the sample project. I have tried using the sample project but have not been able to successfully use that on my end owing to dependencies. However, I have assessed the sample code in your controller class and found setting TextAutofit type setting missing. I suggest you to please try using attached controller file on your end.
HomeController.zip (1.6 KB)
Thanks for the response,
setting TextAutofit type is not working in my case.
Please find the working demo as a console application. ConsoleApp.zip (573.0 KB)
Instruction:
1.We have used Apose.slide version 15.11.0.0 - please add the dll file in bin/ folder of the application.
2.\bin\Debug\PresentationTemplate - Contains presentation template.
3.\bin\Debug\PresentationDownloads - Contents dynamically generated template
Thanks,
@sdtechsupport.sirius,
You are using fairly old version on your end. In my testing, I have used latest version Aspose.Slides for .NET 18.1 on my end. As per suggestion, did you try this version. Please try latest version on your end and I hope things will work on your end. The important point is that you need to set Autofit type before setting text in text frame. Please observe the generated presentation that I created using Aspose.Slides for .NET 18.1.
Demo_Overview_Report.zip (41.8 KB)
Thanks for your feedback.
As per suggestion we have updated aspose version to 18.4. everything working perfectly but we are facing wired issue with new update. there is overflow issue in couple of places in when we generate presentation production environment. until something on the page is edited.
Whereupon PowerPoint then recalculates the shrink-to-fit reduction size and the text display size is updated.
To reproduce the same issue we have created demo console application but in the demo application we are enable to reproduce the issue. we have attached demo application along with presentation which describe the issue. Can you please suggest what can be the cause of the issue.
Instruction:
1.We have used Apose.slide version 18.4 - please add the dll file in bin/ folder of the application.
2.\bin\Debug\PresentationTemplate - Contains presentation template.
3.\bin\Debug\PresentationDownloads - Contents dynamically generated template
We have attached Generated report - Generated report.zip (124.6 KB)
In the attached generated ppt report. it is applying shrink property partially because default font size in template is 10 but in generated report it shows 9. Please note that the content in overflow shape can be extened.
Please suggest.
@sdtechsupport.sirius,
I have observed your comments. Can you please make sure you have attached demo application. I am unable to find any demo application and source file.
Please find the demo application ConsoleApp.zip (621.0 KB)
@sdtechsupport.sirius,
I have worked with the source file and sample project shared by you and have been able to observe the issue specified. An issue with ID SLIDESNET-40105 has been created in our issue tracking system to investigate and resolve the issue. This thread has been linked with the issue so that you may be automatically notified once the issue will be fixed.
Can you please share release plan to address the issue “SLIDESNET-40105” and when it would be available?
Regards,
Vishal
@sdtechsupport.sirius,
I have verified issue status from our issue tracking system and i regret to inform that issue is still unresolved. We are working on this issue and will share good news with you soon.
HI Adnan,
Thanks for the respose! One of our major release is on hold due to this issue and we atleast need to communicate ETA for resolution to our stakeholders. Can I know any rough date or month when this will be resolved?
Thanks.
@sdtechsupport.sirius,
I have observed your comments. I also like to inform that your issue is Scheduled for week 2018/w23. I also like to inform that issue will be resolved tentatively in Aspose.Slides 18.6 which will be released in July. I request for your patience and we will share good news with you soon.
Hi… As Aspose as recently released 18.6 - So is this issue resolved now? Could not find the same in release notes though!
Thanks!
@sdtechsupport.sirius,
I have verified the issue status and regret to share that the concerned issue is unresolved owing to internally blocking issue. We request for your patience till the time the issue gets resolved.