Inline single use interfaces

This commit is contained in:
Dolan
2021-03-15 00:11:39 +00:00
parent 18ce200cdb
commit a3febae8a3
42 changed files with 91 additions and 181 deletions

View File

@ -4,9 +4,9 @@
## Intro ## Intro
* `Tables` contain a list of `Rows` - `Tables` contain a list of `Rows`
* `Rows` contain a list of `TableCells` - `Rows` contain a list of `TableCells`
* `TableCells` contain a list of `Parahraphs` and/or `Tables`. You can add `Tables` as tables can be nested inside each other - `TableCells` contain a list of `Parahraphs` and/or `Tables`. You can add `Tables` as tables can be nested inside each other
Create a simple table like so: Create a simple table like so:
@ -85,11 +85,11 @@ const table = new Table({
Here is a list of options you can add to the `table row`: Here is a list of options you can add to the `table row`:
| Property | Type | Notes | | Property | Type | Notes |
| ----------- | ------------------------------------- | -------- | | ----------- | -------------------------------------- | -------- |
| children | `Array<TableCell>` | Required | | children | `Array<TableCell>` | Required |
| cantSplit | `boolean` | Optional | | cantSplit | `boolean` | Optional |
| tableHeader | `boolean` | Optional | | tableHeader | `boolean` | Optional |
| height | `{ height: number, rule: HeightRule }` | Optional | | height | `{ height: number, rule: HeightRule }` | Optional |
### Repeat row ### Repeat row
@ -142,7 +142,7 @@ const tableRow = new TableRow({
| Property | Type | Notes | | Property | Type | Notes |
| ------------- | ----------------------------------- | ----------------------------------------------------------- | | ------------- | ----------------------------------- | ----------------------------------------------------------- |
| children | `Array<Paragraph | Table>` | Required. You can nest tables by adding a table into a cell | | children | `Array<Paragraph or Table>` | Required. You can nest tables by adding a table into a cell |
| shading | `ITableShadingAttributesProperties` | Optional | | shading | `ITableShadingAttributesProperties` | Optional |
| margins | `ITableCellMarginOptions` | Optional | | margins | `ITableCellMarginOptions` | Optional |
| verticalAlign | `VerticalAlign` | Optional | | verticalAlign | `VerticalAlign` | Optional |
@ -336,7 +336,6 @@ const table = new Table({
}); });
``` ```
## Examples ## Examples
[Example](https://raw.githubusercontent.com/dolanmiu/docx/master/demo/4-basic-table.ts ':include') [Example](https://raw.githubusercontent.com/dolanmiu/docx/master/demo/4-basic-table.ts ':include')

View File

@ -6,12 +6,10 @@ export enum FooterReferenceType {
EVEN = "even", EVEN = "even",
} }
export interface IFooterReferenceAttributes { export class FooterReferenceAttributes extends XmlAttributeComponent<{
readonly type: string; readonly type: string;
readonly id: string; readonly id: string;
} }> {
export class FooterReferenceAttributes extends XmlAttributeComponent<IFooterReferenceAttributes> {
protected readonly xmlKeys = { protected readonly xmlKeys = {
type: "w:type", type: "w:type",
id: "r:id", id: "r:id",

View File

@ -6,12 +6,10 @@ export enum HeaderReferenceType {
EVEN = "even", EVEN = "even",
} }
export interface IHeaderReferenceAttributes { export class HeaderReferenceAttributes extends XmlAttributeComponent<{
readonly type: string; readonly type: string;
readonly id: string; readonly id: string;
} }> {
export class HeaderReferenceAttributes extends XmlAttributeComponent<IHeaderReferenceAttributes> {
protected readonly xmlKeys = { protected readonly xmlKeys = {
type: "w:type", type: "w:type",
id: "r:id", id: "r:id",

View File

@ -1,10 +1,8 @@
import { XmlAttributeComponent } from "file/xml-components"; import { XmlAttributeComponent } from "file/xml-components";
export interface IHeaderReferenceAttributes { export class TitlePageAttributes extends XmlAttributeComponent<{
readonly value: string; readonly value: string;
} }> {
export class TitlePageAttributes extends XmlAttributeComponent<IHeaderReferenceAttributes> {
protected readonly xmlKeys = { protected readonly xmlKeys = {
value: "w:val", value: "w:val",
}; };

View File

@ -1,12 +1,10 @@
import { XmlAttributeComponent } from "file/xml-components"; import { XmlAttributeComponent } from "file/xml-components";
export interface IDocPropertiesAttributes { export class DocPropertiesAttributes extends XmlAttributeComponent<{
readonly id?: number; readonly id?: number;
readonly name?: string; readonly name?: string;
readonly descr?: string; readonly descr?: string;
} }> {
export class DocPropertiesAttributes extends XmlAttributeComponent<IDocPropertiesAttributes> {
protected readonly xmlKeys = { protected readonly xmlKeys = {
id: "id", id: "id",
name: "name", name: "name",

View File

@ -1,13 +1,11 @@
import { XmlAttributeComponent } from "file/xml-components"; import { XmlAttributeComponent } from "file/xml-components";
export interface IEffectExtentAttributes { export class EffectExtentAttributes extends XmlAttributeComponent<{
readonly b?: number; readonly b?: number;
readonly l?: number; readonly l?: number;
readonly r?: number; readonly r?: number;
readonly t?: number; readonly t?: number;
} }> {
export class EffectExtentAttributes extends XmlAttributeComponent<IEffectExtentAttributes> {
protected readonly xmlKeys = { protected readonly xmlKeys = {
b: "b", b: "b",
l: "l", l: "l",

View File

@ -1,11 +1,9 @@
import { XmlAttributeComponent } from "file/xml-components"; import { XmlAttributeComponent } from "file/xml-components";
export interface IExtentAttributes { export class ExtentAttributes extends XmlAttributeComponent<{
readonly cx?: number; readonly cx?: number;
readonly cy?: number; readonly cy?: number;
} }> {
export class ExtentAttributes extends XmlAttributeComponent<IExtentAttributes> {
protected readonly xmlKeys = { protected readonly xmlKeys = {
cx: "cx", cx: "cx",
cy: "cy", cy: "cy",

View File

@ -4,11 +4,9 @@ import { Align } from "./align";
import { HorizontalPositionRelativeFrom, IHorizontalPositionOptions } from "./floating-position"; import { HorizontalPositionRelativeFrom, IHorizontalPositionOptions } from "./floating-position";
import { PositionOffset } from "./position-offset"; import { PositionOffset } from "./position-offset";
interface IHorizontalPositionAttributes { class HorizontalPositionAttributes extends XmlAttributeComponent<{
readonly relativeFrom: HorizontalPositionRelativeFrom; readonly relativeFrom: HorizontalPositionRelativeFrom;
} }> {
class HorizontalPositionAttributes extends XmlAttributeComponent<IHorizontalPositionAttributes> {
protected readonly xmlKeys = { protected readonly xmlKeys = {
relativeFrom: "relativeFrom", relativeFrom: "relativeFrom",
}; };

View File

@ -1,12 +1,10 @@
// http://officeopenxml.com/drwPicFloating-position.php // http://officeopenxml.com/drwPicFloating-position.php
import { XmlAttributeComponent, XmlComponent } from "file/xml-components"; import { XmlAttributeComponent, XmlComponent } from "file/xml-components";
interface ISimplePosAttributes { class SimplePosAttributes extends XmlAttributeComponent<{
readonly x: number; readonly x: number;
readonly y: number; readonly y: number;
} }> {
class SimplePosAttributes extends XmlAttributeComponent<ISimplePosAttributes> {
protected readonly xmlKeys = { protected readonly xmlKeys = {
x: "x", x: "x",
y: "y", y: "y",

View File

@ -4,11 +4,9 @@ import { Align } from "./align";
import { IVerticalPositionOptions, VerticalPositionRelativeFrom } from "./floating-position"; import { IVerticalPositionOptions, VerticalPositionRelativeFrom } from "./floating-position";
import { PositionOffset } from "./position-offset"; import { PositionOffset } from "./position-offset";
interface IVerticalPositionAttributes { class VerticalPositionAttributes extends XmlAttributeComponent<{
readonly relativeFrom: VerticalPositionRelativeFrom; readonly relativeFrom: VerticalPositionRelativeFrom;
} }> {
class VerticalPositionAttributes extends XmlAttributeComponent<IVerticalPositionAttributes> {
protected readonly xmlKeys = { protected readonly xmlKeys = {
relativeFrom: "relativeFrom", relativeFrom: "relativeFrom",
}; };

View File

@ -1,11 +1,9 @@
import { XmlAttributeComponent } from "file/xml-components"; import { XmlAttributeComponent } from "file/xml-components";
export interface IGraphicFrameLockAttributes { export class GraphicFrameLockAttributes extends XmlAttributeComponent<{
readonly xmlns?: string; readonly xmlns?: string;
readonly noChangeAspect?: number; readonly noChangeAspect?: number;
} }> {
export class GraphicFrameLockAttributes extends XmlAttributeComponent<IGraphicFrameLockAttributes> {
protected readonly xmlKeys = { protected readonly xmlKeys = {
xmlns: "xmlns:a", xmlns: "xmlns:a",
noChangeAspect: "noChangeAspect", noChangeAspect: "noChangeAspect",

View File

@ -1,10 +1,8 @@
import { XmlAttributeComponent } from "file/xml-components"; import { XmlAttributeComponent } from "file/xml-components";
export interface IGraphicDataAttributes { export class GraphicDataAttributes extends XmlAttributeComponent<{
readonly uri?: string; readonly uri?: string;
} }> {
export class GraphicDataAttributes extends XmlAttributeComponent<IGraphicDataAttributes> {
protected readonly xmlKeys = { protected readonly xmlKeys = {
uri: "uri", uri: "uri",
}; };

View File

@ -1,12 +1,10 @@
import { IMediaData } from "file/media"; import { IMediaData } from "file/media";
import { XmlAttributeComponent, XmlComponent } from "file/xml-components"; import { XmlAttributeComponent, XmlComponent } from "file/xml-components";
interface IBlipProperties { class BlipAttributes extends XmlAttributeComponent<{
readonly embed: string; readonly embed: string;
readonly cstate: string; readonly cstate: string;
} }> {
class BlipAttributes extends XmlAttributeComponent<IBlipProperties> {
protected readonly xmlKeys = { protected readonly xmlKeys = {
embed: "r:embed", embed: "r:embed",
cstate: "cstate", cstate: "cstate",

View File

@ -1,11 +1,9 @@
import { XmlAttributeComponent } from "file/xml-components"; import { XmlAttributeComponent } from "file/xml-components";
export interface IPicLocksAttributes { export class PicLocksAttributes extends XmlAttributeComponent<{
readonly noChangeAspect?: number; readonly noChangeAspect?: number;
readonly noChangeArrowheads?: number; readonly noChangeArrowheads?: number;
} }> {
export class PicLocksAttributes extends XmlAttributeComponent<IPicLocksAttributes> {
protected readonly xmlKeys = { protected readonly xmlKeys = {
noChangeAspect: "noChangeAspect", noChangeAspect: "noChangeAspect",
noChangeArrowheads: "noChangeArrowheads", noChangeArrowheads: "noChangeArrowheads",

View File

@ -1,12 +1,10 @@
import { XmlAttributeComponent } from "file/xml-components"; import { XmlAttributeComponent } from "file/xml-components";
export interface INonVisualPropertiesAttributes { export class NonVisualPropertiesAttributes extends XmlAttributeComponent<{
readonly id?: number; readonly id?: number;
readonly name?: string; readonly name?: string;
readonly descr?: string; readonly descr?: string;
} }> {
export class NonVisualPropertiesAttributes extends XmlAttributeComponent<INonVisualPropertiesAttributes> {
protected readonly xmlKeys = { protected readonly xmlKeys = {
id: "id", id: "id",
name: "name", name: "name",

View File

@ -1,10 +1,8 @@
import { XmlAttributeComponent } from "file/xml-components"; import { XmlAttributeComponent } from "file/xml-components";
export interface IPicAttributes { export class PicAttributes extends XmlAttributeComponent<{
readonly xmlns?: string; readonly xmlns?: string;
} }> {
export class PicAttributes extends XmlAttributeComponent<IPicAttributes> {
protected readonly xmlKeys = { protected readonly xmlKeys = {
xmlns: "xmlns:pic", xmlns: "xmlns:pic",
}; };

View File

@ -1,11 +1,9 @@
import { XmlAttributeComponent } from "file/xml-components"; import { XmlAttributeComponent } from "file/xml-components";
export interface IExtentsAttributes { export class ExtentsAttributes extends XmlAttributeComponent<{
readonly cx?: number; readonly cx?: number;
readonly cy?: number; readonly cy?: number;
} }> {
export class ExtentsAttributes extends XmlAttributeComponent<IExtentsAttributes> {
protected readonly xmlKeys = { protected readonly xmlKeys = {
cx: "cx", cx: "cx",
cy: "cy", cy: "cy",

View File

@ -1,11 +1,9 @@
import { XmlAttributeComponent } from "file/xml-components"; import { XmlAttributeComponent } from "file/xml-components";
export interface IOffsetAttributes { export class OffsetAttributes extends XmlAttributeComponent<{
readonly x?: number; readonly x?: number;
readonly y?: number; readonly y?: number;
} }> {
export class OffsetAttributes extends XmlAttributeComponent<IOffsetAttributes> {
protected readonly xmlKeys = { protected readonly xmlKeys = {
x: "x", x: "x",
y: "y", y: "y",

View File

@ -1,10 +1,8 @@
import { XmlAttributeComponent } from "file/xml-components"; import { XmlAttributeComponent } from "file/xml-components";
export interface IPresetGeometryAttributes { export class PresetGeometryAttributes extends XmlAttributeComponent<{
readonly prst?: string; readonly prst?: string;
} }> {
export class PresetGeometryAttributes extends XmlAttributeComponent<IPresetGeometryAttributes> {
protected readonly xmlKeys = { protected readonly xmlKeys = {
prst: "prst", prst: "prst",
}; };

View File

@ -1,10 +1,8 @@
import { XmlAttributeComponent } from "file/xml-components"; import { XmlAttributeComponent } from "file/xml-components";
export interface IShapePropertiesAttributes { export class ShapePropertiesAttributes extends XmlAttributeComponent<{
readonly bwMode?: string; readonly bwMode?: string;
} }> {
export class ShapePropertiesAttributes extends XmlAttributeComponent<IShapePropertiesAttributes> {
protected readonly xmlKeys = { protected readonly xmlKeys = {
bwMode: "bwMode", bwMode: "bwMode",
}; };

View File

@ -3,11 +3,9 @@ import { XmlAttributeComponent, XmlComponent } from "file/xml-components";
import { GraphicData } from "./graphic-data"; import { GraphicData } from "./graphic-data";
interface IGraphicProperties { class GraphicAttributes extends XmlAttributeComponent<{
readonly a: string; readonly a: string;
} }> {
class GraphicAttributes extends XmlAttributeComponent<IGraphicProperties> {
protected readonly xmlKeys = { protected readonly xmlKeys = {
a: "xmlns:a", a: "xmlns:a",
}; };

View File

@ -2,14 +2,7 @@ import { XmlAttributeComponent } from "file/xml-components";
import { IDistance } from "../drawing"; import { IDistance } from "../drawing";
// distT, distB etc have no effect on inline images, only floating // distT, distB etc have no effect on inline images, only floating
export interface IInlineAttributes extends IDistance { export class InlineAttributes extends XmlAttributeComponent<IDistance> {
readonly distT?: number;
readonly distB?: number;
readonly distL?: number;
readonly distR?: number;
}
export class InlineAttributes extends XmlAttributeComponent<IInlineAttributes> {
protected readonly xmlKeys = { protected readonly xmlKeys = {
distT: "distT", distT: "distT",
distB: "distB", distB: "distB",

View File

@ -6,10 +6,6 @@ import { IMargins } from "../floating";
interface IWrapSquareAttributes extends IDistance { interface IWrapSquareAttributes extends IDistance {
readonly wrapText?: TextWrappingSide; readonly wrapText?: TextWrappingSide;
readonly distT?: number;
readonly distB?: number;
readonly distL?: number;
readonly distR?: number;
} }
class WrapSquareAttributes extends XmlAttributeComponent<IWrapSquareAttributes> { class WrapSquareAttributes extends XmlAttributeComponent<IWrapSquareAttributes> {

View File

@ -3,12 +3,10 @@ import { XmlAttributeComponent, XmlComponent } from "file/xml-components";
import { IMargins } from "../floating"; import { IMargins } from "../floating";
interface IWrapTightAttributes { class WrapTightAttributes extends XmlAttributeComponent<{
readonly distT?: number; readonly distT?: number;
readonly distB?: number; readonly distB?: number;
} }> {
class WrapTightAttributes extends XmlAttributeComponent<IWrapTightAttributes> {
protected readonly xmlKeys = { protected readonly xmlKeys = {
distT: "distT", distT: "distT",
distB: "distB", distB: "distB",

View File

@ -3,12 +3,10 @@ import { XmlAttributeComponent, XmlComponent } from "file/xml-components";
import { IMargins } from "../floating"; import { IMargins } from "../floating";
interface IWrapTopAndBottomAttributes { class WrapTopAndBottomAttributes extends XmlAttributeComponent<{
readonly distT?: number; readonly distT?: number;
readonly distB?: number; readonly distB?: number;
} }> {
class WrapTopAndBottomAttributes extends XmlAttributeComponent<IWrapTopAndBottomAttributes> {
protected readonly xmlKeys = { protected readonly xmlKeys = {
distT: "distT", distT: "distT",
distB: "distB", distB: "distB",

View File

@ -1,6 +1,6 @@
import { XmlAttributeComponent } from "file/xml-components"; import { XmlAttributeComponent } from "file/xml-components";
export interface IFooterAttributesProperties { export class FooterAttributes extends XmlAttributeComponent<{
readonly wpc?: string; readonly wpc?: string;
readonly mc?: string; readonly mc?: string;
readonly o?: string; readonly o?: string;
@ -23,9 +23,7 @@ export interface IFooterAttributesProperties {
readonly dcmitype?: string; readonly dcmitype?: string;
readonly xsi?: string; readonly xsi?: string;
readonly type?: string; readonly type?: string;
} }> {
export class FooterAttributes extends XmlAttributeComponent<IFooterAttributesProperties> {
protected readonly xmlKeys = { protected readonly xmlKeys = {
wpc: "xmlns:wpc", wpc: "xmlns:wpc",
mc: "xmlns:mc", mc: "xmlns:mc",

View File

@ -1,6 +1,6 @@
import { XmlAttributeComponent } from "file/xml-components"; import { XmlAttributeComponent } from "file/xml-components";
export interface IFootnotesAttributesProperties { export class FootnotesAttributes extends XmlAttributeComponent<{
readonly wpc?: string; readonly wpc?: string;
readonly mc?: string; readonly mc?: string;
readonly o?: string; readonly o?: string;
@ -18,9 +18,7 @@ export interface IFootnotesAttributesProperties {
readonly wne?: string; readonly wne?: string;
readonly wps?: string; readonly wps?: string;
readonly Ignorable?: string; readonly Ignorable?: string;
} }> {
export class FootnotesAttributes extends XmlAttributeComponent<IFootnotesAttributesProperties> {
protected readonly xmlKeys = { protected readonly xmlKeys = {
wpc: "xmlns:wpc", wpc: "xmlns:wpc",
mc: "xmlns:mc", mc: "xmlns:mc",

View File

@ -1,6 +1,6 @@
import { XmlAttributeComponent } from "file/xml-components"; import { XmlAttributeComponent } from "file/xml-components";
export interface IHeaderAttributesProperties { export class HeaderAttributes extends XmlAttributeComponent<{
readonly wpc?: string; readonly wpc?: string;
readonly mc?: string; readonly mc?: string;
readonly o?: string; readonly o?: string;
@ -34,9 +34,7 @@ export interface IHeaderAttributesProperties {
readonly cx8?: string; readonly cx8?: string;
readonly w16cid: string; readonly w16cid: string;
readonly w16se: string; readonly w16se: string;
} }> {
export class HeaderAttributes extends XmlAttributeComponent<IHeaderAttributesProperties> {
protected readonly xmlKeys = { protected readonly xmlKeys = {
wpc: "xmlns:wpc", wpc: "xmlns:wpc",
mc: "xmlns:mc", mc: "xmlns:mc",

View File

@ -21,12 +21,10 @@ export enum LevelFormat {
UPPER_ROMAN = "upperRoman", UPPER_ROMAN = "upperRoman",
} }
interface ILevelAttributesProperties { class LevelAttributes extends XmlAttributeComponent<{
readonly ilvl?: number; readonly ilvl?: number;
readonly tentative?: number; readonly tentative?: number;
} }> {
class LevelAttributes extends XmlAttributeComponent<ILevelAttributesProperties> {
protected readonly xmlKeys = { protected readonly xmlKeys = {
ilvl: "w:ilvl", ilvl: "w:ilvl",
tentative: "w15:tentative", tentative: "w15:tentative",

View File

@ -1,13 +1,11 @@
import { XmlAttributeComponent } from "file/xml-components"; import { XmlAttributeComponent } from "file/xml-components";
export interface IBorderAttributesProperties { export class BorderAttributes extends XmlAttributeComponent<{
readonly color: string; readonly color: string;
readonly space: number; readonly space: number;
readonly val: string; readonly val: string;
readonly sz: number; readonly sz: number;
} }> {
export class BorderAttributes extends XmlAttributeComponent<IBorderAttributesProperties> {
protected readonly xmlKeys = { protected readonly xmlKeys = {
val: "w:val", val: "w:val",
color: "w:color", color: "w:color",

View File

@ -1,22 +1,18 @@
import { XmlAttributeComponent } from "file/xml-components"; import { XmlAttributeComponent } from "file/xml-components";
export interface IBookmarkStartAttributesProperties { export class BookmarkStartAttributes extends XmlAttributeComponent<{
readonly id: string; readonly id: string;
readonly name: string; readonly name: string;
} }> {
export class BookmarkStartAttributes extends XmlAttributeComponent<IBookmarkStartAttributesProperties> {
protected readonly xmlKeys = { protected readonly xmlKeys = {
id: "w:id", id: "w:id",
name: "w:name", name: "w:name",
}; };
} }
export interface IBookmarkEndAttributesProperties { export class BookmarkEndAttributes extends XmlAttributeComponent<{
readonly id: string; readonly id: string;
} }> {
export class BookmarkEndAttributes extends XmlAttributeComponent<IBookmarkEndAttributesProperties> {
protected readonly xmlKeys = { protected readonly xmlKeys = {
id: "w:id", id: "w:id",
}; };

View File

@ -1,11 +1,9 @@
import { XmlAttributeComponent, XmlComponent } from "file/xml-components"; import { XmlAttributeComponent, XmlComponent } from "file/xml-components";
interface ISymbolAttributesProperties { class SymbolAttributes extends XmlAttributeComponent<{
readonly char: string; readonly char: string;
readonly symbolfont?: string; readonly symbolfont?: string;
} }> {
class SymbolAttributes extends XmlAttributeComponent<ISymbolAttributesProperties> {
protected readonly xmlKeys = { protected readonly xmlKeys = {
char: "w:char", char: "w:char",
symbolfont: "w:font", symbolfont: "w:font",

View File

@ -1,10 +1,8 @@
import { XmlAttributeComponent } from "file/xml-components"; import { XmlAttributeComponent } from "file/xml-components";
export interface IRelationshipsAttributesProperties { export class RelationshipsAttributes extends XmlAttributeComponent<{
readonly xmlns: string; readonly xmlns: string;
} }> {
export class RelationshipsAttributes extends XmlAttributeComponent<IRelationshipsAttributesProperties> {
protected readonly xmlKeys = { protected readonly xmlKeys = {
xmlns: "xmlns", xmlns: "xmlns",
}; };

View File

@ -1,13 +1,11 @@
import { XmlAttributeComponent } from "file/xml-components"; import { XmlAttributeComponent } from "file/xml-components";
export interface IRelationshipAttributesProperties { export class RelationshipAttributes extends XmlAttributeComponent<{
readonly id: string; readonly id: string;
readonly type: string; readonly type: string;
readonly target: string; readonly target: string;
readonly targetMode?: string; readonly targetMode?: string;
} }> {
export class RelationshipAttributes extends XmlAttributeComponent<IRelationshipAttributesProperties> {
protected readonly xmlKeys = { protected readonly xmlKeys = {
id: "Id", id: "Id",
type: "Type", type: "Type",

View File

@ -4,7 +4,7 @@ import { DisplayBackgroundShape } from "./display-background-shape";
import { TrackRevisions } from "./track-revisions"; import { TrackRevisions } from "./track-revisions";
import { UpdateFields } from "./update-fields"; import { UpdateFields } from "./update-fields";
export interface ISettingsAttributesProperties { export class SettingsAttributes extends XmlAttributeComponent<{
readonly wpc?: string; readonly wpc?: string;
readonly mc?: string; readonly mc?: string;
readonly o?: string; readonly o?: string;
@ -22,9 +22,7 @@ export interface ISettingsAttributesProperties {
readonly wne?: string; readonly wne?: string;
readonly wps?: string; readonly wps?: string;
readonly Ignorable?: string; readonly Ignorable?: string;
} }> {
export class SettingsAttributes extends XmlAttributeComponent<ISettingsAttributesProperties> {
protected readonly xmlKeys = { protected readonly xmlKeys = {
wpc: "xmlns:wpc", wpc: "xmlns:wpc",
mc: "xmlns:mc", mc: "xmlns:mc",

View File

@ -1,8 +1,8 @@
import { XmlAttributeComponent, XmlComponent } from "file/xml-components"; import { XmlAttributeComponent, XmlComponent } from "file/xml-components";
export interface IUpdateFieldsAttributesProperties {
export class UpdateFieldsAttributes extends XmlAttributeComponent<{
readonly enabled: boolean; readonly enabled: boolean;
} }> {
export class UpdateFieldsAttributes extends XmlAttributeComponent<IUpdateFieldsAttributesProperties> {
protected readonly xmlKeys = { protected readonly xmlKeys = {
enabled: "w:val", enabled: "w:val",
}; };

View File

@ -1,11 +1,9 @@
// http://officeopenxml.com/WPstyleGenProps.php // http://officeopenxml.com/WPstyleGenProps.php
import { XmlAttributeComponent, XmlComponent } from "file/xml-components"; import { XmlAttributeComponent, XmlComponent } from "file/xml-components";
interface IComponentAttributes { class ComponentAttributes extends XmlAttributeComponent<{
readonly val: string | number; readonly val: string | number;
} }> {
class ComponentAttributes extends XmlAttributeComponent<IComponentAttributes> {
protected readonly xmlKeys = { val: "w:val" }; protected readonly xmlKeys = { val: "w:val" };
} }

View File

@ -1,12 +1,10 @@
// http://officeopenxml.com/WPtableCellProperties-Margins.php // http://officeopenxml.com/WPtableCellProperties-Margins.php
import { XmlAttributeComponent, XmlComponent } from "file/xml-components"; import { XmlAttributeComponent, XmlComponent } from "file/xml-components";
export interface ICellMarginProperties { class CellMarginAttributes extends XmlAttributeComponent<{
readonly type: string; readonly type: string;
readonly width: number; readonly width: number;
} }> {
class CellMarginAttributes extends XmlAttributeComponent<ICellMarginProperties> {
protected readonly xmlKeys = { width: "w:w", type: "w:type" }; protected readonly xmlKeys = { width: "w:w", type: "w:type" };
} }

View File

@ -1,13 +1,11 @@
import { BorderStyle } from "file/styles"; import { BorderStyle } from "file/styles";
import { IgnoreIfEmptyXmlComponent, XmlAttributeComponent, XmlComponent } from "file/xml-components"; import { IgnoreIfEmptyXmlComponent, XmlAttributeComponent, XmlComponent } from "file/xml-components";
interface ICellBorder { class CellBorderAttributes extends XmlAttributeComponent<{
readonly style: BorderStyle; readonly style: BorderStyle;
readonly size: number; readonly size: number;
readonly color: string; readonly color: string;
} }> {
class CellBorderAttributes extends XmlAttributeComponent<ICellBorder> {
protected readonly xmlKeys = { style: "w:val", size: "w:sz", color: "w:color" }; protected readonly xmlKeys = { style: "w:val", size: "w:sz", color: "w:color" };
} }

View File

@ -3,12 +3,10 @@ import { XmlAttributeComponent, XmlComponent } from "file/xml-components";
import { WidthType } from "../table-cell"; import { WidthType } from "../table-cell";
interface ITableWidth { class TableWidthAttributes extends XmlAttributeComponent<{
readonly type: WidthType; readonly type: WidthType;
readonly w: number | string; readonly w: number | string;
} }> {
class TableWidthAttributes extends XmlAttributeComponent<ITableWidth> {
protected readonly xmlKeys = { type: "w:type", w: "w:w" }; protected readonly xmlKeys = { type: "w:type", w: "w:w" };
} }

View File

@ -9,12 +9,10 @@ export enum HeightRule {
EXACT = "exact", EXACT = "exact",
} }
interface ITableRowHeight { export class TableRowHeightAttributes extends XmlAttributeComponent<{
readonly value: number; readonly value: number;
readonly rule: HeightRule; readonly rule: HeightRule;
} }> {
export class TableRowHeightAttributes extends XmlAttributeComponent<ITableRowHeight> {
protected readonly xmlKeys = { value: "w:val", rule: "w:hRule" }; protected readonly xmlKeys = { value: "w:val", rule: "w:hRule" };
} }

View File

@ -1,6 +1,6 @@
import { XmlAttributeComponent } from "./default-attributes"; import { XmlAttributeComponent } from "./default-attributes";
export interface IAttributesProperties { export class Attributes extends XmlAttributeComponent<{
readonly val?: string | number | boolean; readonly val?: string | number | boolean;
readonly color?: string; readonly color?: string;
readonly fill?: string; readonly fill?: string;
@ -21,9 +21,7 @@ export interface IAttributesProperties {
readonly gutter?: string; readonly gutter?: string;
readonly linePitch?: string; readonly linePitch?: string;
readonly pos?: string | number; // Little strange. Perhaps it is normal. Need to clarify in the spec. readonly pos?: string | number; // Little strange. Perhaps it is normal. Need to clarify in the spec.
} }> {
export class Attributes extends XmlAttributeComponent<IAttributesProperties> {
protected readonly xmlKeys = { protected readonly xmlKeys = {
val: "w:val", val: "w:val",
color: "w:color", color: "w:color",