Files
docx-js/src/file/paragraph/run/text-run.ts

26 lines
702 B
TypeScript
Raw Normal View History

import { FootnoteReferenceRun } from "file/footnotes/footnote/run/reference-run";
2019-06-17 01:51:57 +01:00
import { IRunOptions, Run } from "./run";
import { Text } from "./run-components/text";
2016-03-30 03:50:53 +01:00
2019-06-17 01:51:57 +01:00
export interface ITextRunOptions extends IRunOptions {
readonly text: string;
}
2016-03-30 03:50:53 +01:00
export class TextRun extends Run {
2019-06-17 01:51:57 +01:00
constructor(options: ITextRunOptions | string) {
if (typeof options === "string") {
super({});
this.root.push(new Text(options));
return;
}
super(options);
this.root.push(new Text(options.text));
2016-03-30 03:50:53 +01:00
}
public referenceFootnote(id: number): TextRun {
this.root.push(new FootnoteReferenceRun(id));
return this;
}
2017-03-08 21:49:41 +00:00
}