Files
docx-js/docs/usage/text-box.md
Zohar Hodaya Revivio 3654eb0800 New Textbox Component (#2718)
* Adding textbox with no props

* Fixing namings and adding shape style

* simplify usage

* Fix linting issues

* Re-name demo

* Use new shape authoring style

* Add tests

Simplify API

* Add better types for styles

* Add more options to TextBox and add documentation

---------

Co-authored-by: zohar11 <zohar@sumit-ai.com>
Co-authored-by: Dolan <dolan_miu@hotmail.com>
2024-11-28 10:33:19 +00:00

735 B

Text Box

Similar Text Frames, but the difference being that it is VML Shape based.

!> Text Boxes requires an understanding of Paragraphs.

Text boxes are paragraphs of text in a document which are positioned in a separate region or frame in the document, and can be positioned with a specific size and position relative to non-frame paragraphs in the current document.

Intro

To make a Text Box, simply create a Textbox object inside the Document:

new Textbox({
    alignment: "center",
    children: [
        new Paragraph({
            children: [new TextRun("Hi i'm a textbox!")],
        }),
    ],
    style: {
        width: "200pt",
        height: "auto",
    },
});