Spire.Doc is a professional Word .NET library specifically designed for developers to create, read, write, convert and print Word document files. Get free and professional technical support for Spire.Doc for .NET, Java, Android, C++, Python.

Mon Jan 04, 2021 2:45 am

Newby here just evaluating Spire.Doc.

Is there a "TextBox Overflow" function??

In other words, a function that will indicate if there is too much text to fit into a textbox??

"Word.Interop" has such a function -- IIRC, it's "Textbox.Overflow", and returns a boolean indicating whether or not the desired text fits into the selected Textbox.

I need that so I can adjust the size of the textbox depending on the amount of text that needs to go into it, which varies according to what is happening in my program.

Thanks!

Narniaman
 
Posts: 5
Joined: Sun Mar 01, 2020 2:24 am

Mon Jan 04, 2021 8:24 am

Hello,

Thanks for your inquiry.
Sorry that our Spire.Doc doesn’t have the "TextBox Overflow" function as you described. But we support specifying whether the textbox stretches to fit the text in the textbox. You can refer to the following code to set the textbox to automatically resize.
Code: Select all
            Document doc = new Document();
            Section section = doc.AddSection();
            TextBox textBox1 = section.Body.AddParagraph().AppendTextBox(40, 35);
            Paragraph para = textBox1.Body.AddParagraph();
            TextRange txtrg = para.AppendText("Spire.Doc for .NET is a totally independent .NET Word class library which doesn't require Microsoft Office installed on system. Microsoft Office Automation is proved to be unstable, slow and not scalable to produce MS Word documents. ");
            textBox1.Format.IsFitShapeToText = true;

            doc.SaveToFile("result.docx", FileFormat.Docx);

If there are any other questions, please feel free to contact us.

Sincerely,
Brian
E-iceblue support team
User avatar

Brian.Li
 
Posts: 1271
Joined: Mon Oct 19, 2020 3:04 am

Mon Jan 04, 2021 5:25 pm

Thank you. . . that works perfectly for what I need!!

Narniaman
 
Posts: 5
Joined: Sun Mar 01, 2020 2:24 am

Tue Jan 05, 2021 1:30 am

Hello,

You are welcome.
If you encounter any issues related to our products in the future, please feel free to contact us.

Sincerely,
Brian
E-iceblue support team
User avatar

Brian.Li
 
Posts: 1271
Joined: Mon Oct 19, 2020 3:04 am

Return to Spire.Doc