docxml
Version:
TypeScript (component) library for building and parsing a DOCX file
83 lines (82 loc) • 2.82 kB
TypeScript
import { Length } from '../utilities/length.js';
import { type Shading } from './shared-properties.js';
declare type SimpleOrComplex<Generic> = {
simple?: Generic | null;
complex?: Generic | null;
};
/**
* All the formatting options that can be given on a text run (inline text).
*
* Serializes to the <w:rPr> element.
* https://c-rex.net/projects/samples/ooxml/e1/Part4/OOXML_P4_DOCX_rPr_topic_ID0EIEKM.html
*/
export declare type TextProperties = {
/**
* Show this text according to the style that is referenced through this style identifier.
*/
style?: string | null;
/**
* The color of this text. Type as a hexidecimal code (`"ff0000"`) or a basic color name (`"red"`).
*/
color?: string | null;
/**
* The background color of this paragraph, optionally with a pattern in a secondary color.
*/
shading?: null | Shading;
/**
* The baseline position of this text.
*/
verticalAlign?: 'baseline' | 'subscript' | 'superscript' | null;
/**
* Display this text with an underline, and if so, what kind of line.
*/
isUnderlined?: null | boolean | 'single' | 'words' | 'double' | 'thick' | 'dotted' | 'dottedHeavy' | 'dash' | 'dashedHeavy' | 'dashLong' | 'dashLongHeavy' | 'dotDash' | 'dashDotHeavy' | 'dotDotDash' | 'dashDotDotHeavy' | 'wave' | 'wavyHeavy' | 'wavyDouble' | 'none';
/**
* Display extra thick characters, or not.
*/
isBold?: boolean | SimpleOrComplex<boolean> | null;
/**
* Display text with a slant, or not.
*/
isItalic?: boolean | SimpleOrComplex<boolean> | null;
/**
* Display text as capital letters, or not.
*/
isCaps?: boolean | null;
/**
* Display text as small capital letters, or not.
*/
isSmallCaps?: boolean | null;
/**
* The language of this bit of text, for spell checking.
*/
language?: string | null;
/**
* The size of your font.
*/
fontSize?: Length | SimpleOrComplex<Length> | null;
/**
* If the font size is equal or larger to `.minimumKerningFontSize`, font kerning should be applied.
*/
minimumKerningFontSize?: Length | null;
/**
* Display text with a strike-through, or not.
*/
isStrike?: boolean | null;
/**
* The space between letters.
*/
spacing?: Length | null;
/**
* The name of the font family used for this text. Set as either a string, or as an object if you
* want more control over different font variations.
*/
font?: string | {
cs?: string;
ascii?: string;
hAnsi?: string;
};
};
export declare function textPropertiesFromNode(node?: Node | null): TextProperties;
export declare function textPropertiesToNode(data?: TextProperties): Node | null;
export {};