Inline single use interfaces
This commit is contained in:
@ -4,9 +4,9 @@
|
||||
|
||||
## Intro
|
||||
|
||||
* `Tables` contain a list of `Rows`
|
||||
* `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
|
||||
- `Tables` contain a list of `Rows`
|
||||
- `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
|
||||
|
||||
Create a simple table like so:
|
||||
|
||||
@ -86,7 +86,7 @@ const table = new Table({
|
||||
Here is a list of options you can add to the `table row`:
|
||||
|
||||
| Property | Type | Notes |
|
||||
| ----------- | ------------------------------------- | -------- |
|
||||
| ----------- | -------------------------------------- | -------- |
|
||||
| children | `Array<TableCell>` | Required |
|
||||
| cantSplit | `boolean` | Optional |
|
||||
| tableHeader | `boolean` | Optional |
|
||||
@ -142,7 +142,7 @@ const tableRow = new TableRow({
|
||||
|
||||
| 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 |
|
||||
| margins | `ITableCellMarginOptions` | Optional |
|
||||
| verticalAlign | `VerticalAlign` | Optional |
|
||||
@ -336,7 +336,6 @@ const table = new Table({
|
||||
});
|
||||
```
|
||||
|
||||
|
||||
## Examples
|
||||
|
||||
[Example](https://raw.githubusercontent.com/dolanmiu/docx/master/demo/4-basic-table.ts ':include')
|
||||
|
@ -6,12 +6,10 @@ export enum FooterReferenceType {
|
||||
EVEN = "even",
|
||||
}
|
||||
|
||||
export interface IFooterReferenceAttributes {
|
||||
export class FooterReferenceAttributes extends XmlAttributeComponent<{
|
||||
readonly type: string;
|
||||
readonly id: string;
|
||||
}
|
||||
|
||||
export class FooterReferenceAttributes extends XmlAttributeComponent<IFooterReferenceAttributes> {
|
||||
}> {
|
||||
protected readonly xmlKeys = {
|
||||
type: "w:type",
|
||||
id: "r:id",
|
||||
|
@ -6,12 +6,10 @@ export enum HeaderReferenceType {
|
||||
EVEN = "even",
|
||||
}
|
||||
|
||||
export interface IHeaderReferenceAttributes {
|
||||
export class HeaderReferenceAttributes extends XmlAttributeComponent<{
|
||||
readonly type: string;
|
||||
readonly id: string;
|
||||
}
|
||||
|
||||
export class HeaderReferenceAttributes extends XmlAttributeComponent<IHeaderReferenceAttributes> {
|
||||
}> {
|
||||
protected readonly xmlKeys = {
|
||||
type: "w:type",
|
||||
id: "r:id",
|
||||
|
@ -1,10 +1,8 @@
|
||||
import { XmlAttributeComponent } from "file/xml-components";
|
||||
|
||||
export interface IHeaderReferenceAttributes {
|
||||
export class TitlePageAttributes extends XmlAttributeComponent<{
|
||||
readonly value: string;
|
||||
}
|
||||
|
||||
export class TitlePageAttributes extends XmlAttributeComponent<IHeaderReferenceAttributes> {
|
||||
}> {
|
||||
protected readonly xmlKeys = {
|
||||
value: "w:val",
|
||||
};
|
||||
|
@ -1,12 +1,10 @@
|
||||
import { XmlAttributeComponent } from "file/xml-components";
|
||||
|
||||
export interface IDocPropertiesAttributes {
|
||||
export class DocPropertiesAttributes extends XmlAttributeComponent<{
|
||||
readonly id?: number;
|
||||
readonly name?: string;
|
||||
readonly descr?: string;
|
||||
}
|
||||
|
||||
export class DocPropertiesAttributes extends XmlAttributeComponent<IDocPropertiesAttributes> {
|
||||
}> {
|
||||
protected readonly xmlKeys = {
|
||||
id: "id",
|
||||
name: "name",
|
||||
|
@ -1,13 +1,11 @@
|
||||
import { XmlAttributeComponent } from "file/xml-components";
|
||||
|
||||
export interface IEffectExtentAttributes {
|
||||
export class EffectExtentAttributes extends XmlAttributeComponent<{
|
||||
readonly b?: number;
|
||||
readonly l?: number;
|
||||
readonly r?: number;
|
||||
readonly t?: number;
|
||||
}
|
||||
|
||||
export class EffectExtentAttributes extends XmlAttributeComponent<IEffectExtentAttributes> {
|
||||
}> {
|
||||
protected readonly xmlKeys = {
|
||||
b: "b",
|
||||
l: "l",
|
||||
|
@ -1,11 +1,9 @@
|
||||
import { XmlAttributeComponent } from "file/xml-components";
|
||||
|
||||
export interface IExtentAttributes {
|
||||
export class ExtentAttributes extends XmlAttributeComponent<{
|
||||
readonly cx?: number;
|
||||
readonly cy?: number;
|
||||
}
|
||||
|
||||
export class ExtentAttributes extends XmlAttributeComponent<IExtentAttributes> {
|
||||
}> {
|
||||
protected readonly xmlKeys = {
|
||||
cx: "cx",
|
||||
cy: "cy",
|
||||
|
@ -4,11 +4,9 @@ import { Align } from "./align";
|
||||
import { HorizontalPositionRelativeFrom, IHorizontalPositionOptions } from "./floating-position";
|
||||
import { PositionOffset } from "./position-offset";
|
||||
|
||||
interface IHorizontalPositionAttributes {
|
||||
class HorizontalPositionAttributes extends XmlAttributeComponent<{
|
||||
readonly relativeFrom: HorizontalPositionRelativeFrom;
|
||||
}
|
||||
|
||||
class HorizontalPositionAttributes extends XmlAttributeComponent<IHorizontalPositionAttributes> {
|
||||
}> {
|
||||
protected readonly xmlKeys = {
|
||||
relativeFrom: "relativeFrom",
|
||||
};
|
||||
|
@ -1,12 +1,10 @@
|
||||
// http://officeopenxml.com/drwPicFloating-position.php
|
||||
import { XmlAttributeComponent, XmlComponent } from "file/xml-components";
|
||||
|
||||
interface ISimplePosAttributes {
|
||||
class SimplePosAttributes extends XmlAttributeComponent<{
|
||||
readonly x: number;
|
||||
readonly y: number;
|
||||
}
|
||||
|
||||
class SimplePosAttributes extends XmlAttributeComponent<ISimplePosAttributes> {
|
||||
}> {
|
||||
protected readonly xmlKeys = {
|
||||
x: "x",
|
||||
y: "y",
|
||||
|
@ -4,11 +4,9 @@ import { Align } from "./align";
|
||||
import { IVerticalPositionOptions, VerticalPositionRelativeFrom } from "./floating-position";
|
||||
import { PositionOffset } from "./position-offset";
|
||||
|
||||
interface IVerticalPositionAttributes {
|
||||
class VerticalPositionAttributes extends XmlAttributeComponent<{
|
||||
readonly relativeFrom: VerticalPositionRelativeFrom;
|
||||
}
|
||||
|
||||
class VerticalPositionAttributes extends XmlAttributeComponent<IVerticalPositionAttributes> {
|
||||
}> {
|
||||
protected readonly xmlKeys = {
|
||||
relativeFrom: "relativeFrom",
|
||||
};
|
||||
|
@ -1,11 +1,9 @@
|
||||
import { XmlAttributeComponent } from "file/xml-components";
|
||||
|
||||
export interface IGraphicFrameLockAttributes {
|
||||
export class GraphicFrameLockAttributes extends XmlAttributeComponent<{
|
||||
readonly xmlns?: string;
|
||||
readonly noChangeAspect?: number;
|
||||
}
|
||||
|
||||
export class GraphicFrameLockAttributes extends XmlAttributeComponent<IGraphicFrameLockAttributes> {
|
||||
}> {
|
||||
protected readonly xmlKeys = {
|
||||
xmlns: "xmlns:a",
|
||||
noChangeAspect: "noChangeAspect",
|
||||
|
@ -1,10 +1,8 @@
|
||||
import { XmlAttributeComponent } from "file/xml-components";
|
||||
|
||||
export interface IGraphicDataAttributes {
|
||||
export class GraphicDataAttributes extends XmlAttributeComponent<{
|
||||
readonly uri?: string;
|
||||
}
|
||||
|
||||
export class GraphicDataAttributes extends XmlAttributeComponent<IGraphicDataAttributes> {
|
||||
}> {
|
||||
protected readonly xmlKeys = {
|
||||
uri: "uri",
|
||||
};
|
||||
|
@ -1,12 +1,10 @@
|
||||
import { IMediaData } from "file/media";
|
||||
import { XmlAttributeComponent, XmlComponent } from "file/xml-components";
|
||||
|
||||
interface IBlipProperties {
|
||||
class BlipAttributes extends XmlAttributeComponent<{
|
||||
readonly embed: string;
|
||||
readonly cstate: string;
|
||||
}
|
||||
|
||||
class BlipAttributes extends XmlAttributeComponent<IBlipProperties> {
|
||||
}> {
|
||||
protected readonly xmlKeys = {
|
||||
embed: "r:embed",
|
||||
cstate: "cstate",
|
||||
|
@ -1,11 +1,9 @@
|
||||
import { XmlAttributeComponent } from "file/xml-components";
|
||||
|
||||
export interface IPicLocksAttributes {
|
||||
export class PicLocksAttributes extends XmlAttributeComponent<{
|
||||
readonly noChangeAspect?: number;
|
||||
readonly noChangeArrowheads?: number;
|
||||
}
|
||||
|
||||
export class PicLocksAttributes extends XmlAttributeComponent<IPicLocksAttributes> {
|
||||
}> {
|
||||
protected readonly xmlKeys = {
|
||||
noChangeAspect: "noChangeAspect",
|
||||
noChangeArrowheads: "noChangeArrowheads",
|
||||
|
@ -1,12 +1,10 @@
|
||||
import { XmlAttributeComponent } from "file/xml-components";
|
||||
|
||||
export interface INonVisualPropertiesAttributes {
|
||||
export class NonVisualPropertiesAttributes extends XmlAttributeComponent<{
|
||||
readonly id?: number;
|
||||
readonly name?: string;
|
||||
readonly descr?: string;
|
||||
}
|
||||
|
||||
export class NonVisualPropertiesAttributes extends XmlAttributeComponent<INonVisualPropertiesAttributes> {
|
||||
}> {
|
||||
protected readonly xmlKeys = {
|
||||
id: "id",
|
||||
name: "name",
|
||||
|
@ -1,10 +1,8 @@
|
||||
import { XmlAttributeComponent } from "file/xml-components";
|
||||
|
||||
export interface IPicAttributes {
|
||||
export class PicAttributes extends XmlAttributeComponent<{
|
||||
readonly xmlns?: string;
|
||||
}
|
||||
|
||||
export class PicAttributes extends XmlAttributeComponent<IPicAttributes> {
|
||||
}> {
|
||||
protected readonly xmlKeys = {
|
||||
xmlns: "xmlns:pic",
|
||||
};
|
||||
|
@ -1,11 +1,9 @@
|
||||
import { XmlAttributeComponent } from "file/xml-components";
|
||||
|
||||
export interface IExtentsAttributes {
|
||||
export class ExtentsAttributes extends XmlAttributeComponent<{
|
||||
readonly cx?: number;
|
||||
readonly cy?: number;
|
||||
}
|
||||
|
||||
export class ExtentsAttributes extends XmlAttributeComponent<IExtentsAttributes> {
|
||||
}> {
|
||||
protected readonly xmlKeys = {
|
||||
cx: "cx",
|
||||
cy: "cy",
|
||||
|
@ -1,11 +1,9 @@
|
||||
import { XmlAttributeComponent } from "file/xml-components";
|
||||
|
||||
export interface IOffsetAttributes {
|
||||
export class OffsetAttributes extends XmlAttributeComponent<{
|
||||
readonly x?: number;
|
||||
readonly y?: number;
|
||||
}
|
||||
|
||||
export class OffsetAttributes extends XmlAttributeComponent<IOffsetAttributes> {
|
||||
}> {
|
||||
protected readonly xmlKeys = {
|
||||
x: "x",
|
||||
y: "y",
|
||||
|
@ -1,10 +1,8 @@
|
||||
import { XmlAttributeComponent } from "file/xml-components";
|
||||
|
||||
export interface IPresetGeometryAttributes {
|
||||
export class PresetGeometryAttributes extends XmlAttributeComponent<{
|
||||
readonly prst?: string;
|
||||
}
|
||||
|
||||
export class PresetGeometryAttributes extends XmlAttributeComponent<IPresetGeometryAttributes> {
|
||||
}> {
|
||||
protected readonly xmlKeys = {
|
||||
prst: "prst",
|
||||
};
|
||||
|
@ -1,10 +1,8 @@
|
||||
import { XmlAttributeComponent } from "file/xml-components";
|
||||
|
||||
export interface IShapePropertiesAttributes {
|
||||
export class ShapePropertiesAttributes extends XmlAttributeComponent<{
|
||||
readonly bwMode?: string;
|
||||
}
|
||||
|
||||
export class ShapePropertiesAttributes extends XmlAttributeComponent<IShapePropertiesAttributes> {
|
||||
}> {
|
||||
protected readonly xmlKeys = {
|
||||
bwMode: "bwMode",
|
||||
};
|
||||
|
@ -3,11 +3,9 @@ import { XmlAttributeComponent, XmlComponent } from "file/xml-components";
|
||||
|
||||
import { GraphicData } from "./graphic-data";
|
||||
|
||||
interface IGraphicProperties {
|
||||
class GraphicAttributes extends XmlAttributeComponent<{
|
||||
readonly a: string;
|
||||
}
|
||||
|
||||
class GraphicAttributes extends XmlAttributeComponent<IGraphicProperties> {
|
||||
}> {
|
||||
protected readonly xmlKeys = {
|
||||
a: "xmlns:a",
|
||||
};
|
||||
|
@ -2,14 +2,7 @@ import { XmlAttributeComponent } from "file/xml-components";
|
||||
import { IDistance } from "../drawing";
|
||||
|
||||
// distT, distB etc have no effect on inline images, only floating
|
||||
export interface IInlineAttributes extends IDistance {
|
||||
readonly distT?: number;
|
||||
readonly distB?: number;
|
||||
readonly distL?: number;
|
||||
readonly distR?: number;
|
||||
}
|
||||
|
||||
export class InlineAttributes extends XmlAttributeComponent<IInlineAttributes> {
|
||||
export class InlineAttributes extends XmlAttributeComponent<IDistance> {
|
||||
protected readonly xmlKeys = {
|
||||
distT: "distT",
|
||||
distB: "distB",
|
||||
|
@ -6,10 +6,6 @@ import { IMargins } from "../floating";
|
||||
|
||||
interface IWrapSquareAttributes extends IDistance {
|
||||
readonly wrapText?: TextWrappingSide;
|
||||
readonly distT?: number;
|
||||
readonly distB?: number;
|
||||
readonly distL?: number;
|
||||
readonly distR?: number;
|
||||
}
|
||||
|
||||
class WrapSquareAttributes extends XmlAttributeComponent<IWrapSquareAttributes> {
|
||||
|
@ -3,12 +3,10 @@ import { XmlAttributeComponent, XmlComponent } from "file/xml-components";
|
||||
|
||||
import { IMargins } from "../floating";
|
||||
|
||||
interface IWrapTightAttributes {
|
||||
class WrapTightAttributes extends XmlAttributeComponent<{
|
||||
readonly distT?: number;
|
||||
readonly distB?: number;
|
||||
}
|
||||
|
||||
class WrapTightAttributes extends XmlAttributeComponent<IWrapTightAttributes> {
|
||||
}> {
|
||||
protected readonly xmlKeys = {
|
||||
distT: "distT",
|
||||
distB: "distB",
|
||||
|
@ -3,12 +3,10 @@ import { XmlAttributeComponent, XmlComponent } from "file/xml-components";
|
||||
|
||||
import { IMargins } from "../floating";
|
||||
|
||||
interface IWrapTopAndBottomAttributes {
|
||||
class WrapTopAndBottomAttributes extends XmlAttributeComponent<{
|
||||
readonly distT?: number;
|
||||
readonly distB?: number;
|
||||
}
|
||||
|
||||
class WrapTopAndBottomAttributes extends XmlAttributeComponent<IWrapTopAndBottomAttributes> {
|
||||
}> {
|
||||
protected readonly xmlKeys = {
|
||||
distT: "distT",
|
||||
distB: "distB",
|
||||
|
@ -1,6 +1,6 @@
|
||||
import { XmlAttributeComponent } from "file/xml-components";
|
||||
|
||||
export interface IFooterAttributesProperties {
|
||||
export class FooterAttributes extends XmlAttributeComponent<{
|
||||
readonly wpc?: string;
|
||||
readonly mc?: string;
|
||||
readonly o?: string;
|
||||
@ -23,9 +23,7 @@ export interface IFooterAttributesProperties {
|
||||
readonly dcmitype?: string;
|
||||
readonly xsi?: string;
|
||||
readonly type?: string;
|
||||
}
|
||||
|
||||
export class FooterAttributes extends XmlAttributeComponent<IFooterAttributesProperties> {
|
||||
}> {
|
||||
protected readonly xmlKeys = {
|
||||
wpc: "xmlns:wpc",
|
||||
mc: "xmlns:mc",
|
||||
|
@ -1,6 +1,6 @@
|
||||
import { XmlAttributeComponent } from "file/xml-components";
|
||||
|
||||
export interface IFootnotesAttributesProperties {
|
||||
export class FootnotesAttributes extends XmlAttributeComponent<{
|
||||
readonly wpc?: string;
|
||||
readonly mc?: string;
|
||||
readonly o?: string;
|
||||
@ -18,9 +18,7 @@ export interface IFootnotesAttributesProperties {
|
||||
readonly wne?: string;
|
||||
readonly wps?: string;
|
||||
readonly Ignorable?: string;
|
||||
}
|
||||
|
||||
export class FootnotesAttributes extends XmlAttributeComponent<IFootnotesAttributesProperties> {
|
||||
}> {
|
||||
protected readonly xmlKeys = {
|
||||
wpc: "xmlns:wpc",
|
||||
mc: "xmlns:mc",
|
||||
|
@ -1,6 +1,6 @@
|
||||
import { XmlAttributeComponent } from "file/xml-components";
|
||||
|
||||
export interface IHeaderAttributesProperties {
|
||||
export class HeaderAttributes extends XmlAttributeComponent<{
|
||||
readonly wpc?: string;
|
||||
readonly mc?: string;
|
||||
readonly o?: string;
|
||||
@ -34,9 +34,7 @@ export interface IHeaderAttributesProperties {
|
||||
readonly cx8?: string;
|
||||
readonly w16cid: string;
|
||||
readonly w16se: string;
|
||||
}
|
||||
|
||||
export class HeaderAttributes extends XmlAttributeComponent<IHeaderAttributesProperties> {
|
||||
}> {
|
||||
protected readonly xmlKeys = {
|
||||
wpc: "xmlns:wpc",
|
||||
mc: "xmlns:mc",
|
||||
|
@ -21,12 +21,10 @@ export enum LevelFormat {
|
||||
UPPER_ROMAN = "upperRoman",
|
||||
}
|
||||
|
||||
interface ILevelAttributesProperties {
|
||||
class LevelAttributes extends XmlAttributeComponent<{
|
||||
readonly ilvl?: number;
|
||||
readonly tentative?: number;
|
||||
}
|
||||
|
||||
class LevelAttributes extends XmlAttributeComponent<ILevelAttributesProperties> {
|
||||
}> {
|
||||
protected readonly xmlKeys = {
|
||||
ilvl: "w:ilvl",
|
||||
tentative: "w15:tentative",
|
||||
|
@ -1,13 +1,11 @@
|
||||
import { XmlAttributeComponent } from "file/xml-components";
|
||||
|
||||
export interface IBorderAttributesProperties {
|
||||
export class BorderAttributes extends XmlAttributeComponent<{
|
||||
readonly color: string;
|
||||
readonly space: number;
|
||||
readonly val: string;
|
||||
readonly sz: number;
|
||||
}
|
||||
|
||||
export class BorderAttributes extends XmlAttributeComponent<IBorderAttributesProperties> {
|
||||
}> {
|
||||
protected readonly xmlKeys = {
|
||||
val: "w:val",
|
||||
color: "w:color",
|
||||
|
@ -1,22 +1,18 @@
|
||||
import { XmlAttributeComponent } from "file/xml-components";
|
||||
|
||||
export interface IBookmarkStartAttributesProperties {
|
||||
export class BookmarkStartAttributes extends XmlAttributeComponent<{
|
||||
readonly id: string;
|
||||
readonly name: string;
|
||||
}
|
||||
|
||||
export class BookmarkStartAttributes extends XmlAttributeComponent<IBookmarkStartAttributesProperties> {
|
||||
}> {
|
||||
protected readonly xmlKeys = {
|
||||
id: "w:id",
|
||||
name: "w:name",
|
||||
};
|
||||
}
|
||||
|
||||
export interface IBookmarkEndAttributesProperties {
|
||||
export class BookmarkEndAttributes extends XmlAttributeComponent<{
|
||||
readonly id: string;
|
||||
}
|
||||
|
||||
export class BookmarkEndAttributes extends XmlAttributeComponent<IBookmarkEndAttributesProperties> {
|
||||
}> {
|
||||
protected readonly xmlKeys = {
|
||||
id: "w:id",
|
||||
};
|
||||
|
@ -1,11 +1,9 @@
|
||||
import { XmlAttributeComponent, XmlComponent } from "file/xml-components";
|
||||
|
||||
interface ISymbolAttributesProperties {
|
||||
class SymbolAttributes extends XmlAttributeComponent<{
|
||||
readonly char: string;
|
||||
readonly symbolfont?: string;
|
||||
}
|
||||
|
||||
class SymbolAttributes extends XmlAttributeComponent<ISymbolAttributesProperties> {
|
||||
}> {
|
||||
protected readonly xmlKeys = {
|
||||
char: "w:char",
|
||||
symbolfont: "w:font",
|
||||
|
@ -1,10 +1,8 @@
|
||||
import { XmlAttributeComponent } from "file/xml-components";
|
||||
|
||||
export interface IRelationshipsAttributesProperties {
|
||||
export class RelationshipsAttributes extends XmlAttributeComponent<{
|
||||
readonly xmlns: string;
|
||||
}
|
||||
|
||||
export class RelationshipsAttributes extends XmlAttributeComponent<IRelationshipsAttributesProperties> {
|
||||
}> {
|
||||
protected readonly xmlKeys = {
|
||||
xmlns: "xmlns",
|
||||
};
|
||||
|
@ -1,13 +1,11 @@
|
||||
import { XmlAttributeComponent } from "file/xml-components";
|
||||
|
||||
export interface IRelationshipAttributesProperties {
|
||||
export class RelationshipAttributes extends XmlAttributeComponent<{
|
||||
readonly id: string;
|
||||
readonly type: string;
|
||||
readonly target: string;
|
||||
readonly targetMode?: string;
|
||||
}
|
||||
|
||||
export class RelationshipAttributes extends XmlAttributeComponent<IRelationshipAttributesProperties> {
|
||||
}> {
|
||||
protected readonly xmlKeys = {
|
||||
id: "Id",
|
||||
type: "Type",
|
||||
|
@ -4,7 +4,7 @@ import { DisplayBackgroundShape } from "./display-background-shape";
|
||||
import { TrackRevisions } from "./track-revisions";
|
||||
import { UpdateFields } from "./update-fields";
|
||||
|
||||
export interface ISettingsAttributesProperties {
|
||||
export class SettingsAttributes extends XmlAttributeComponent<{
|
||||
readonly wpc?: string;
|
||||
readonly mc?: string;
|
||||
readonly o?: string;
|
||||
@ -22,9 +22,7 @@ export interface ISettingsAttributesProperties {
|
||||
readonly wne?: string;
|
||||
readonly wps?: string;
|
||||
readonly Ignorable?: string;
|
||||
}
|
||||
|
||||
export class SettingsAttributes extends XmlAttributeComponent<ISettingsAttributesProperties> {
|
||||
}> {
|
||||
protected readonly xmlKeys = {
|
||||
wpc: "xmlns:wpc",
|
||||
mc: "xmlns:mc",
|
||||
|
@ -1,8 +1,8 @@
|
||||
import { XmlAttributeComponent, XmlComponent } from "file/xml-components";
|
||||
export interface IUpdateFieldsAttributesProperties {
|
||||
|
||||
export class UpdateFieldsAttributes extends XmlAttributeComponent<{
|
||||
readonly enabled: boolean;
|
||||
}
|
||||
export class UpdateFieldsAttributes extends XmlAttributeComponent<IUpdateFieldsAttributesProperties> {
|
||||
}> {
|
||||
protected readonly xmlKeys = {
|
||||
enabled: "w:val",
|
||||
};
|
||||
|
@ -1,11 +1,9 @@
|
||||
// http://officeopenxml.com/WPstyleGenProps.php
|
||||
import { XmlAttributeComponent, XmlComponent } from "file/xml-components";
|
||||
|
||||
interface IComponentAttributes {
|
||||
class ComponentAttributes extends XmlAttributeComponent<{
|
||||
readonly val: string | number;
|
||||
}
|
||||
|
||||
class ComponentAttributes extends XmlAttributeComponent<IComponentAttributes> {
|
||||
}> {
|
||||
protected readonly xmlKeys = { val: "w:val" };
|
||||
}
|
||||
|
||||
|
@ -1,12 +1,10 @@
|
||||
// http://officeopenxml.com/WPtableCellProperties-Margins.php
|
||||
import { XmlAttributeComponent, XmlComponent } from "file/xml-components";
|
||||
|
||||
export interface ICellMarginProperties {
|
||||
class CellMarginAttributes extends XmlAttributeComponent<{
|
||||
readonly type: string;
|
||||
readonly width: number;
|
||||
}
|
||||
|
||||
class CellMarginAttributes extends XmlAttributeComponent<ICellMarginProperties> {
|
||||
}> {
|
||||
protected readonly xmlKeys = { width: "w:w", type: "w:type" };
|
||||
}
|
||||
|
||||
|
@ -1,13 +1,11 @@
|
||||
import { BorderStyle } from "file/styles";
|
||||
import { IgnoreIfEmptyXmlComponent, XmlAttributeComponent, XmlComponent } from "file/xml-components";
|
||||
|
||||
interface ICellBorder {
|
||||
class CellBorderAttributes extends XmlAttributeComponent<{
|
||||
readonly style: BorderStyle;
|
||||
readonly size: number;
|
||||
readonly color: string;
|
||||
}
|
||||
|
||||
class CellBorderAttributes extends XmlAttributeComponent<ICellBorder> {
|
||||
}> {
|
||||
protected readonly xmlKeys = { style: "w:val", size: "w:sz", color: "w:color" };
|
||||
}
|
||||
|
||||
|
@ -3,12 +3,10 @@ import { XmlAttributeComponent, XmlComponent } from "file/xml-components";
|
||||
|
||||
import { WidthType } from "../table-cell";
|
||||
|
||||
interface ITableWidth {
|
||||
class TableWidthAttributes extends XmlAttributeComponent<{
|
||||
readonly type: WidthType;
|
||||
readonly w: number | string;
|
||||
}
|
||||
|
||||
class TableWidthAttributes extends XmlAttributeComponent<ITableWidth> {
|
||||
}> {
|
||||
protected readonly xmlKeys = { type: "w:type", w: "w:w" };
|
||||
}
|
||||
|
||||
|
@ -9,12 +9,10 @@ export enum HeightRule {
|
||||
EXACT = "exact",
|
||||
}
|
||||
|
||||
interface ITableRowHeight {
|
||||
export class TableRowHeightAttributes extends XmlAttributeComponent<{
|
||||
readonly value: number;
|
||||
readonly rule: HeightRule;
|
||||
}
|
||||
|
||||
export class TableRowHeightAttributes extends XmlAttributeComponent<ITableRowHeight> {
|
||||
}> {
|
||||
protected readonly xmlKeys = { value: "w:val", rule: "w:hRule" };
|
||||
}
|
||||
|
||||
|
@ -1,6 +1,6 @@
|
||||
import { XmlAttributeComponent } from "./default-attributes";
|
||||
|
||||
export interface IAttributesProperties {
|
||||
export class Attributes extends XmlAttributeComponent<{
|
||||
readonly val?: string | number | boolean;
|
||||
readonly color?: string;
|
||||
readonly fill?: string;
|
||||
@ -21,9 +21,7 @@ export interface IAttributesProperties {
|
||||
readonly gutter?: string;
|
||||
readonly linePitch?: string;
|
||||
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 = {
|
||||
val: "w:val",
|
||||
color: "w:color",
|
||||
|
Reference in New Issue
Block a user