Update tab-stops.md
corrected docs to reflect declarative style for tab stops; removed tab() and bold()
This commit is contained in:
@ -4,15 +4,15 @@
|
|||||||
|
|
||||||
!> **Note**: The unit of measurement for a tab stop is in [DXA](https://stackoverflow.com/questions/14360183/default-wordml-unit-measurement-pixel-or-point-or-inches)
|
!> **Note**: The unit of measurement for a tab stop is in [DXA](https://stackoverflow.com/questions/14360183/default-wordml-unit-measurement-pixel-or-point-or-inches)
|
||||||
|
|
||||||

|

|
||||||
|
|
||||||
Simply call the relevant methods on the paragraph listed below. Then just add a `tab()` method call to a text object. Adding multiple `tabStops` will mean you would have to chain `tab()` until the desired `tabStop` is selected. Example is shown below.
|
Simply declare the tab stops on the paragraph, as shown below. Use the tab character `\t` to indicate the tab position within the `text` property of a `TextRun`. Adding multiple `tabStops` will mean you can add additional `\t` characters until the desired `tabStop` is selected. Example is shown below.
|
||||||
|
|
||||||
## Example
|
## Example
|
||||||
|
|
||||||
```ts
|
```ts
|
||||||
const paragraph = new Paragraph({
|
const paragraph = new Paragraph({
|
||||||
children: [new TextRun("Hey everyone").bold(), new TextRun(\t"11th November 1999")],
|
children: [new TextRun({ text: "Hey everyone", bold: true}, new TextRun("\t11th November 1999")],
|
||||||
tabStops: [
|
tabStops: [
|
||||||
{
|
{
|
||||||
type: TabStopType.RIGHT,
|
type: TabStopType.RIGHT,
|
||||||
@ -26,7 +26,7 @@ The example above will create a left aligned text, and a right aligned text on t
|
|||||||
|
|
||||||
```ts
|
```ts
|
||||||
const paragraph = new Paragraph({
|
const paragraph = new Paragraph({
|
||||||
children: [new TextRun("Second tab stop here I come!")],
|
children: [new TextRun("\t\tSecond tab stop here I come!")],
|
||||||
tabStops: [
|
tabStops: [
|
||||||
{
|
{
|
||||||
type: TabStopType.RIGHT,
|
type: TabStopType.RIGHT,
|
||||||
@ -46,7 +46,7 @@ You can add multiple tab stops of the same `type` too.
|
|||||||
|
|
||||||
```ts
|
```ts
|
||||||
const paragraph = new Paragraph({
|
const paragraph = new Paragraph({
|
||||||
children: [new TextRun("Multiple tab stops!")],
|
children: [new TextRun("Multiple \ttab \tstops!")],
|
||||||
tabStops: [
|
tabStops: [
|
||||||
{
|
{
|
||||||
type: TabStopType.RIGHT,
|
type: TabStopType.RIGHT,
|
||||||
|
Reference in New Issue
Block a user