49 Color(uint8_t red, uint8_t green, uint8_t blue) :
r(red),
g(green),
b(blue),
is_auto(false) {}
52 std::string
hex()
const;
170 Style add(
const std::string &styleId,
const std::string &type =
"paragraph");
248 int replaceText(
const std::string &search,
const std::string &replace);
349 long long xOffset = 0,
long long yOffset = 0);
360 Paragraph &
setSpacing(
int beforeTwips,
int afterTwips,
int lineSpacing = -1, gsl::czstring lineRule =
"auto");
371 TextBox addTextBox(
long long widthEMU,
long long heightEMU,
long long xOffsetEMU = 0,
long long yOffsetEMU = 0);
388 int replaceText(
const std::string &search,
const std::string &replace);
420 long long xOffset = 0,
long long yOffset = 0);
433 int replaceText(
const std::string &search,
const std::string &replace);
460 void mergeCells(
int startRow,
int startCol,
int endRow,
int endCol);
477 int replaceText(
const std::string &search,
const std::string &replace);
499 std::string
jc =
"left";
520 int addList(
int abstractNumId,
int restartNumId = -1);
591 explicit Document(
const std::string &templatePath);
599 bool save(gsl::czstring filepath);
600 bool load(gsl::czstring filepath);
652 int createComment(
const std::string &text,
const std::string &author =
"Author",
const std::string &initials =
"");
663 void addStyle(gsl::czstring styleId, gsl::czstring name);
668 int replaceText(
const std::string &search,
const std::string &replace);
677 int cloneRowAndSetValues(
const std::string &search,
const std::vector<std::map<std::string, std::string>> &values);
684 std::unique_ptr<Impl> pimpl;
Definition Document.h:505
AbstractNumbering & addLevel(const ListLevel &level)
AbstractNumbering(void *node)
Definition Document.h:404
Cell & setShading(const std::string &hexColor)
Cell & setBorders(const BorderSettings &all)
void addHtml(const std::string &html)
Cell & setWidth(int twips, const std::string &type="dxa")
Paragraph addParagraph(const std::string &text="")
void addImage(gsl::czstring image_path, double scale=1.0, ImagePosition position=ImagePosition::Inline, long long xOffset=0, long long yOffset=0)
Cell & setBorders(const BorderSettings &top, const BorderSettings &bottom, const BorderSettings &left, const BorderSettings &right)
int replaceText(const std::string &search, const std::string &replace)
Table addTable(int rows, int cols)
Nests a new table inside this cell.
std::string vMerge() const
std::vector< BlockElement > elements() const
Cell & setVertAlign(VerticalAlignment align)
std::vector< Paragraph > paragraphs() const
Definition Document.h:573
std::string relId() const
Represents the main Office Open XML Word document (.docx).
Definition Document.h:588
Table addTable(int rows, int cols)
Nests a new table inside this cell.
std::vector< BlockElement > elements() const
std::vector< Table > tables() const
std::string convertMathMLToOMML(const std::string &mathml) const
void addHtml(const std::string &html)
void addWatermark(const std::string &text)
Document & operator=(const Document &)=delete
std::vector< Paragraph > paragraphs() const
std::string convertLaTeXToOMML(const std::string &latex) const
std::map< int, std::string > endnotes() const
Retrieves all endnotes in the document as a map of ID to text.
Document(const Document &)=delete
void addStyle(gsl::czstring styleId, gsl::czstring name)
Chart addChart(ChartType type, const std::vector< ChartSeries > &series, const ChartOptions &options=ChartOptions())
std::vector< Chart > charts() const
void setEvenAndOddHeaders(bool val=true)
int cloneRowAndSetValues(const std::string &search, const std::vector< std::map< std::string, std::string > > &values)
Template Engine: Clones a table row containing the search string. Generates a new row for each elemen...
Paragraph addParagraph(const std::string &text="")
bool validate(gsl::czstring partName, const SchemaValidator &validator, std::string &outErrors) const
void addTableOfContents(gsl::czstring title="Table of Contents", int max_levels=3, TOCLeader leader=TOCLeader::Dot)
Document(const std::string &templatePath)
bool save(gsl::czstring filepath)
void setMetadata(const Metadata &meta)
bool load(gsl::czstring filepath)
int createComment(const std::string &text, const std::string &author="Author", const std::string &initials="")
Creates a new comment in the document's global comments registry.
int replaceText(const std::string &search, const std::string &replace)
NumberingCollection numbering()
Metadata metadata() const
int createFootnote(const std::string &text)
std::map< int, std::string > footnotes() const
Retrieves all footnotes in the document as a map of ID to text.
int createEndnote(const std::string &text)
Definition Document.h:108
Font & setItalic(bool val=true)
Font & setName(const std::string &ascii)
Font & setBold(bool val=true)
Font & setColor(const std::string &hexColor)
Font & setSize(int halfPoints)
Definition Document.h:514
NumberingCollection(void *node)
int addList(int abstractNumId, int restartNumId=-1)
AbstractNumbering addAbstractNumbering(int abstractNumId)
Definition Document.h:322
Run addPageNumber()
Injects a dynamic PAGE field code to display the current page number.
Paragraph & setAlignment(gsl::czstring align)
Run addRun(const std::string &text="")
Paragraph & setOutlineLevel(int level)
void insertBookmark(gsl::czstring name)
Section appendSectionBreak()
void addEndnoteReference(int endnoteId)
TextBox addTextBox(long long widthEMU, long long heightEMU, long long xOffsetEMU=0, long long yOffsetEMU=0)
std::vector< Run > runs() const
void addImage(gsl::czstring image_path, double scale=1.0, ImagePosition position=ImagePosition::Inline, long long xOffset=0, long long yOffset=0)
Adds an image to the paragraph.
Paragraph & setStyle(gsl::czstring styleId)
Paragraph & setSpacing(int beforeTwips, int afterTwips, int lineSpacing=-1, gsl::czstring lineRule="auto")
std::string styleId() const
Paragraph & setList(int numId, int level=0)
Run addTotalPages()
Injects a dynamic NUMPAGES field code to display the total document page count.
Run addHyperlink(gsl::czstring text, gsl::czstring url)
Paragraph & setBorders(const BorderSettings &all)
Run addInternalLink(gsl::czstring text, gsl::czstring bookmarkName)
Paragraph & setIndentation(int leftTwips, int rightTwips, int firstLineTwips=0, int hangingTwips=0)
void addEquation(const std::string &omml)
Adds a raw OMML (Office Math Markup Language) equation to the paragraph.
std::string alignment() const
void addFootnoteReference(int footnoteId)
Table insertTableAfter(int rows, int cols)
int replaceText(const std::string &search, const std::string &replace)
Paragraph & setBorders(const BorderSettings &top, const BorderSettings &bottom, const BorderSettings &left, const BorderSettings &right)
Paragraph & setShading(const std::string &hexColor)
void addRawXml(const std::string &xml)
Paragraph insertParagraphAfter(const std::string &text="")
Definition Document.h:234
Row & setCantSplit(bool cantSplit=true)
std::vector< Cell > cells() const
Row & setHeight(int twips, HeightRule rule=HeightRule::AtLeast)
int replaceText(const std::string &search, const std::string &replace)
Row & setRepeatHeaderRow(bool repeat=true)
Definition Document.h:256
HighlightColor highlightColor() const
Run & addPageBreak()
Inserts a hard page break (<w:br w:type="page"/>) pushing subsequent text to the next page.
Run & setBold(bool val=true)
Run & setColor(const Color &color)
Run & setStrike(bool val=true)
Run & setUnderline(gsl::czstring val="single")
Run & setHighlight(HighlightColor color)
bool isEndnoteReference() const
Run & setFontSize(int halfPoints)
Run & setCharacterSpacing(int twips)
Run & setItalic(bool val=true)
bool isFootnoteReference() const
Run & addLineBreak()
Inserts a soft line break (<w:br/>) in the current run (equivalent to Shift+Enter).
Run & setFontFamily(gsl::czstring ascii, gsl::czstring eastAsia="")
Run & setVertAlign(VertAlign align)
Run & setHighlight(gsl::czstring color)
Run & addComment(int commentId)
Anchors an existing comment to this specific text run.
Run & setText(const std::string &text)
Run & setDoubleStrike(bool val=true)
Run & setShading(const Color &fillColor)
Definition Document.h:203
Section & removeHeader(HeaderFooterType type=HeaderFooterType::Default)
Removes the header of the specified type from this section and blocks inheritance from previous secti...
Section & setMargins(const Margins &margins)
Footer addFooter(HeaderFooterType type=HeaderFooterType::Default)
Section & removeFooter(HeaderFooterType type=HeaderFooterType::Default)
Removes the footer of the specified type from this section and blocks inheritance.
Section & setColumns(int count, int spaceTwips=720)
Section & setPageSize(uint32_t w_twips, uint32_t h_twips, Orientation orient=Orientation::Portrait)
Header addHeader(HeaderFooterType type=HeaderFooterType::Default)
Definition Document.h:153
ParagraphFormat getDefaultParagraphFormat()
Retrieves the global document default paragraph format settings (w:docDefaults/w:pPrDefault).
Style get(const std::string &styleId)
Style add(const std::string &styleId, const std::string &type="paragraph")
Font getDefaultFont()
Retrieves the global document default font settings (w:docDefaults/w:rPrDefault). Modifying this affe...
StyleCollection(void *node)
Definition Document.h:131
Style & setUiPriority(int priority)
Style & setHidden(bool isHidden=true)
Style & setPrimary(bool isPrimary=true)
Style & setBasedOn(const std::string &parentStyleId)
ParagraphFormat getParagraphFormat()
Style & setNextStyle(const std::string &nextStyleId)
Style & setName(const std::string &name)
Represents a Table in the Word document.
Definition Document.h:452
Table & setBorders(const BorderSettings &top, const BorderSettings &bottom, const BorderSettings &left, const BorderSettings &right, const BorderSettings &insideH, const BorderSettings &insideV)
Table & setBorders(const BorderSettings &all)
int replaceText(const std::string &search, const std::string &replace)
Paragraph insertParagraphAfter(const std::string &text="")
Cell cell(int row, int col)
Table & setColumnWidths(const std::vector< int > &twipsList)
std::vector< BlockElement > elements() const
Table & setAlignment(gsl::czstring align)
std::string vMerge() const
Table & setColumnWidth(int colIndex, int twips)
Table & setBorders(const BorderSettings &outer, const BorderSettings &inner)
std::vector< Row > rows() const
void mergeCells(int startRow, int startCol, int endRow, int endCol)
Definition Document.h:530
TextBox & setFillColor(const std::string &hexColor)
void addHtml(const std::string &html)
Paragraph addParagraph(const std::string &text="")
TextBox & setLineColor(const std::string &hexColor)
BorderStyle
Definition Document.h:73
LegendPosition
Definition Document.h:547
ImagePosition
Definition Document.h:176
ChartType
Definition Document.h:545
ScatterStyle
Definition Document.h:551
NumberingFormat
Represents a Microsoft Word Document (.docx)
Definition Document.h:493
HighlightColor
Definition Document.h:23
Orientation
Definition Document.h:57
TOCLeader
Definition Document.h:17
ListType
Definition Document.h:69
std::variant< Paragraph, Table, Section > BlockElement
Definition Document.h:21
VertAlign
Definition Document.h:55
VerticalAlignment
Definition Document.h:80
AreaGrouping
Definition Document.h:549
HeaderFooterType
Definition Document.h:71
HeightRule
Definition Document.h:81
BorderStyle style
Definition Document.h:75
std::string color
Definition Document.h:77
int size
Definition Document.h:76
Definition Document.h:553
std::string title
Definition Document.h:554
AreaGrouping areaGrouping
Definition Document.h:562
bool smoothLines
Definition Document.h:561
bool showDataLabels
Definition Document.h:556
int widthTwips
Definition Document.h:557
LegendPosition legendPos
Definition Document.h:555
int heightTwips
Definition Document.h:558
ScatterStyle scatterStyle
Definition Document.h:560
Definition Document.h:565
std::vector< double > xValues
Definition Document.h:568
std::vector< std::string > categories
Definition Document.h:567
std::vector< double > values
Definition Document.h:569
std::string name
Definition Document.h:566
std::string colorHex
Definition Document.h:570
uint8_t g
Definition Document.h:44
bool is_auto
Definition Document.h:46
Color(uint8_t red, uint8_t green, uint8_t blue)
Definition Document.h:49
static Color Auto()
Definition Document.h:51
uint8_t r
Definition Document.h:43
uint8_t b
Definition Document.h:45
Type
Definition Document.h:84
std::string value
Definition Document.h:86
Type type
Definition Document.h:85
Definition Document.h:495
NumberingFormat format
Definition Document.h:497
int levelIndex
Definition Document.h:496
std::string jc
Definition Document.h:499
std::string fontAscii
Definition Document.h:502
int indentTwips
Definition Document.h:500
std::string text
Definition Document.h:498
int hangingTwips
Definition Document.h:501
int bottom
Definition Document.h:62
int top
Definition Document.h:60
int footer
Definition Document.h:65
int header
Definition Document.h:64
int gutter
Definition Document.h:66
int right
Definition Document.h:61
int left
Definition Document.h:63