mirror of
https://github.com/tfussell/xlnt.git
synced 2024-03-22 13:11:17 +08:00
clean up readme, move technical stuff to separate documentation website
This commit is contained in:
parent
472dd85026
commit
1d34d966a8
3
.gitignore
vendored
3
.gitignore
vendored
|
@ -1,8 +1,9 @@
|
||||||
bin/
|
bin/
|
||||||
lib/
|
lib/
|
||||||
build/
|
build/
|
||||||
docs/_*/
|
docs/build/
|
||||||
docs/doxyxml/
|
docs/doxyxml/
|
||||||
|
node_modules/
|
||||||
*.obj
|
*.obj
|
||||||
*.sdf
|
*.sdf
|
||||||
*.suo
|
*.suo
|
||||||
|
|
113
README.md
113
README.md
|
@ -8,17 +8,17 @@
|
||||||
[![License](http://img.shields.io/badge/license-MIT-blue.svg?style=flat)](http://opensource.org/licenses/MIT)
|
[![License](http://img.shields.io/badge/license-MIT-blue.svg?style=flat)](http://opensource.org/licenses/MIT)
|
||||||
|
|
||||||
## Introduction
|
## Introduction
|
||||||
xlnt is a C++14 library for reading, writing, and modifying xlsx files as described in [ECMA 376 4th edition](http://www.ecma-international.org/publications/standards/Ecma-376.htm). The API was initially based on [openpyxl](https://bitbucket.org/openpyxl/openpyxl), a Python library to read/write Excel 2007 xlsx/xlsm files, which was itself based on [PHPExcel](https://github.com/PHPOffice/PHPExcel), pure PHP library for reading and writing spreadsheet files. xlnt is still very much a work in progress, but the core development work is complete. For a high-level summary of what you can do with this library, see [here](http://xlnt.readthedocs.io/en/latest/#summary-of-features).
|
xlnt is a modern C++ library for manipulating spreadsheets in memory and reading/writing them from/to XLSX files as described in [ECMA 376 4th edition](http://www.ecma-international.org/publications/standards/Ecma-376.htm). xlnt is currently under active feature development and is on track for the version 1.0 release in the next few weeks. Until then, the API could have significant changes. For a high-level summary of what you can do with this library, see [here](https://thomas.fussell.io/xlnt/#features).
|
||||||
|
|
||||||
|
## Example
|
||||||
|
|
||||||
|
Including xlnt in your project, creating a new spreadsheet, and saving it as "example.xlsx"
|
||||||
|
|
||||||
## Usage
|
|
||||||
Including xlnt in your project
|
|
||||||
```c++
|
```c++
|
||||||
// with -std=c++14 -Ixlnt/include -Lxlnt/lib -lxlnt
|
|
||||||
#include <xlnt/xlnt.hpp>
|
#include <xlnt/xlnt.hpp>
|
||||||
```
|
|
||||||
|
|
||||||
Creating a new spreadsheet and saving it as "example.xlsx"
|
int main()
|
||||||
```c++
|
{
|
||||||
xlnt::workbook wb;
|
xlnt::workbook wb;
|
||||||
xlnt::worksheet ws = wb.active_sheet();
|
xlnt::worksheet ws = wb.active_sheet();
|
||||||
ws.cell("A1").value(5);
|
ws.cell("A1").value(5);
|
||||||
|
@ -27,105 +27,14 @@ Creating a new spreadsheet and saving it as "example.xlsx"
|
||||||
ws.merge_cells("C3:C4");
|
ws.merge_cells("C3:C4");
|
||||||
ws.freeze_panes("B2");
|
ws.freeze_panes("B2");
|
||||||
wb.save("example.xlsx");
|
wb.save("example.xlsx");
|
||||||
```
|
return 0;
|
||||||
|
}
|
||||||
## Building
|
// compile with -std=c++14 -Ixlnt/include -Lxlnt/lib -lxlnt
|
||||||
xlnt uses continous integration (thanks [Travis CI](https://travis-ci.org/) and [AppVeyor](https://www.appveyor.com/)!) and passes all 270+ tests in GCC 4, GCC 5, VS2015 U3, and Clang (using Apple LLVM 8.0). Build configurations for Visual Studio 2015, GNU Make, and Xcode can be created using [cmake](https://cmake.org/) v3.1+. A full list of cmake generators can be found [here](https://cmake.org/cmake/help/v3.0/manual/cmake-generators.7.html). A basic build would look like (starting in the root xlnt directory):
|
|
||||||
|
|
||||||
```bash
|
|
||||||
mkdir build
|
|
||||||
cd build
|
|
||||||
cmake ..
|
|
||||||
make -j8
|
|
||||||
```
|
|
||||||
|
|
||||||
The resulting shared (e.g. libxlnt.dylib) library would be found in the build/lib directory. Other cmake configuration options for xlnt can be found using "cmake -LH". These options include building a static library instead of shared and whether to build sample executables or not. An example of building a static library with an Xcode project:
|
|
||||||
|
|
||||||
```bash
|
|
||||||
mkdir build
|
|
||||||
cd build
|
|
||||||
cmake -D STATIC=ON -G Xcode ..
|
|
||||||
cmake --build .
|
|
||||||
cd bin && ./xlnt.test
|
|
||||||
```
|
|
||||||
*Note for Windows: cmake defaults to building a 32-bit library project. To build a 64-bit library, use the Win64 generator*
|
|
||||||
```bash
|
|
||||||
cmake -G "Visual Studio 14 2015 Win64" ..
|
|
||||||
```
|
|
||||||
|
|
||||||
## Dependencies
|
|
||||||
xlnt requires the following libraries which are all distributed under permissive open source licenses. All libraries are included in the source tree as [git submodules](https://git-scm.com/book/en/v2/Git-Tools-Submodules#Cloning-a-Project-with-Submodules) for convenience except for pole and partio's zip component which have been modified and reside in xlnt/source/detail:
|
|
||||||
- [zlib v1.2.8](http://zlib.net/) (zlib License)
|
|
||||||
- [libstudxml v1.1.0](http://www.codesynthesis.com/projects/libstudxml/) (MIT license)
|
|
||||||
- [utfcpp v2.3.4](http://utfcpp.sourceforge.net/) (Boost Software License, Version 1.0)
|
|
||||||
- [Crypto++ v5.6.5](https://www.cryptopp.com/) (Boost Software License, Version 1.0)
|
|
||||||
- [pole v0.5](https://github.com/catlan/pole) (BSD 2-Clause License)
|
|
||||||
- [partio v1.1.0](https://github.com/wdas/partio) (BSD 3-Clause License with specific non-attribution clause)
|
|
||||||
|
|
||||||
Additionally, the xlnt test suite (bin/xlnt.test) requires an extra testing library. This test executable is separate from the main xlnt library assembly so the terms of this library's license should not apply to users of solely the xlnt library:
|
|
||||||
- [cxxtest v4.4](http://cxxtest.com/) (LGPLv3 License)
|
|
||||||
|
|
||||||
Initialize the submodules from the HEAD of their respective Git repositories with this command called from the xlnt root directory:
|
|
||||||
```bash
|
|
||||||
git submodule update --init --remote
|
|
||||||
```
|
```
|
||||||
|
|
||||||
## Documentation
|
## Documentation
|
||||||
|
|
||||||
Properties
|
Documentation for the current release of xlnt is available [here](https://thomas.fussell.io/xlnt).
|
||||||
|
|
||||||
```c++
|
|
||||||
xlnt::workbook wb;
|
|
||||||
|
|
||||||
wb.core_property(xlnt::core_property::category, "hors categorie");
|
|
||||||
wb.core_property(xlnt::core_property::content_status, "good");
|
|
||||||
wb.core_property(xlnt::core_property::created, xlnt::datetime(2017, 1, 15));
|
|
||||||
wb.core_property(xlnt::core_property::creator, "me");
|
|
||||||
wb.core_property(xlnt::core_property::description, "description");
|
|
||||||
wb.core_property(xlnt::core_property::identifier, "id");
|
|
||||||
wb.core_property(xlnt::core_property::keywords, { "wow", "such" });
|
|
||||||
wb.core_property(xlnt::core_property::language, "Esperanto");
|
|
||||||
wb.core_property(xlnt::core_property::last_modified_by, "someone");
|
|
||||||
wb.core_property(xlnt::core_property::last_printed, xlnt::datetime(2017, 1, 15));
|
|
||||||
wb.core_property(xlnt::core_property::modified, xlnt::datetime(2017, 1, 15));
|
|
||||||
wb.core_property(xlnt::core_property::revision, "3");
|
|
||||||
wb.core_property(xlnt::core_property::subject, "subject");
|
|
||||||
wb.core_property(xlnt::core_property::title, "title");
|
|
||||||
wb.core_property(xlnt::core_property::version, "1.0");
|
|
||||||
|
|
||||||
wb.extended_property(xlnt::extended_property::application, "xlnt");
|
|
||||||
wb.extended_property(xlnt::extended_property::app_version, "0.9.3");
|
|
||||||
wb.extended_property(xlnt::extended_property::characters, 123);
|
|
||||||
wb.extended_property(xlnt::extended_property::characters_with_spaces, 124);
|
|
||||||
wb.extended_property(xlnt::extended_property::company, "Incorporated Inc.");
|
|
||||||
wb.extended_property(xlnt::extended_property::dig_sig, "?");
|
|
||||||
wb.extended_property(xlnt::extended_property::doc_security, 0);
|
|
||||||
wb.extended_property(xlnt::extended_property::heading_pairs, true);
|
|
||||||
wb.extended_property(xlnt::extended_property::hidden_slides, false);
|
|
||||||
wb.extended_property(xlnt::extended_property::h_links, 0);
|
|
||||||
wb.extended_property(xlnt::extended_property::hyperlink_base, 0);
|
|
||||||
wb.extended_property(xlnt::extended_property::hyperlinks_changed, true);
|
|
||||||
wb.extended_property(xlnt::extended_property::lines, 42);
|
|
||||||
wb.extended_property(xlnt::extended_property::links_up_to_date, false);
|
|
||||||
wb.extended_property(xlnt::extended_property::manager, "johnny");
|
|
||||||
wb.extended_property(xlnt::extended_property::m_m_clips, "?");
|
|
||||||
wb.extended_property(xlnt::extended_property::notes, "note");
|
|
||||||
wb.extended_property(xlnt::extended_property::pages, 19);
|
|
||||||
wb.extended_property(xlnt::extended_property::paragraphs, 18);
|
|
||||||
wb.extended_property(xlnt::extended_property::presentation_format, "format");
|
|
||||||
wb.extended_property(xlnt::extended_property::scale_crop, true);
|
|
||||||
wb.extended_property(xlnt::extended_property::shared_doc, false);
|
|
||||||
wb.extended_property(xlnt::extended_property::slides, 17);
|
|
||||||
wb.extended_property(xlnt::extended_property::template_, "template!");
|
|
||||||
wb.extended_property(xlnt::extended_property::titles_of_parts, { "title" });
|
|
||||||
wb.extended_property(xlnt::extended_property::total_time, 16);
|
|
||||||
wb.extended_property(xlnt::extended_property::words, 101);
|
|
||||||
|
|
||||||
wb.custom_property("test", { 1, 2, 3 });
|
|
||||||
wb.custom_property("Editor", "John Smith");
|
|
||||||
|
|
||||||
wb.save("lots_of_properties.xlsx");
|
|
||||||
```
|
|
||||||
|
|
||||||
## License
|
## License
|
||||||
xlnt is released to the public for free under the terms of the MIT License. See [LICENSE.md](https://github.com/tfussell/xlnt/blob/master/LICENCE.md) for the full text of the license and the licenses of xlnt's third-party dependencies. [LICENSE.md](https://github.com/tfussell/xlnt/blob/master/LICENCE.md) should be distributed alongside any assemblies that use xlnt in source or compiled form.
|
xlnt is released to the public for free under the terms of the MIT License. See [LICENSE.md](https://github.com/tfussell/xlnt/blob/master/LICENCE.md) for the full text of the license and the licenses of xlnt's third-party dependencies. [LICENSE.md](https://github.com/tfussell/xlnt/blob/master/LICENCE.md) should be distributed alongside any assemblies that use xlnt in source or compiled form.
|
||||||
|
|
|
@ -1,238 +0,0 @@
|
||||||
|
|
||||||
# API Reference
|
|
||||||
|
|
||||||
## Cell Module
|
|
||||||
|
|
||||||
### cell class
|
|
||||||
|
|
||||||
Describes cell associated properties.
|
|
||||||
|
|
||||||
Properties of interest include style, type, value, and address. The Cell class is required to know its value and type, display options, and any other features of an Excel cell.Utilities for referencing cells using Excel’s ‘A1’ column/row nomenclature are also provided.
|
|
||||||
|
|
||||||
#### `cell(const cell&)`
|
|
||||||
Default copy constructor.
|
|
||||||
|
|
||||||
#### `bool has_value() const`
|
|
||||||
Return true if value has been set and has not been cleared using cell::clear_value().
|
|
||||||
|
|
||||||
#### `template <typename T> T value() const`
|
|
||||||
Return the value of this cell as an instance of type T. Overloads exist for most C++ fundamental types like bool, int, etc. as well as for std::string and xlnt datetime types: date, time, datetime, and timedelta.
|
|
||||||
|
|
||||||
#### `void clear_value()`
|
|
||||||
Make this cell have a value of type null. All other cell attributes are retained.
|
|
||||||
|
|
||||||
#### `template <typename T> void value(T value)`
|
|
||||||
Set the value of this cell to the given value. Overloads exist for most C++ fundamental types like bool, int, etc. as well as for std::string and xlnt datetime types: date, time, datetime, and timedelta.
|
|
||||||
|
|
||||||
#### `void value(const std::string &string_value, bool infer_type)`
|
|
||||||
Analyze string_value to determine its type, convert it to that type, and set the value of this cell to that converted value.
|
|
||||||
|
|
||||||
#### `type data_type() const`
|
|
||||||
Return the type of this cell.
|
|
||||||
|
|
||||||
#### `void data_type(type t)`
|
|
||||||
Set the type of this cell.
|
|
||||||
|
|
||||||
#### `bool garbage_collectible() const`
|
|
||||||
There’s no reason to keep a cell which has no value and is not a placeholder. Return true if this cell has no value, style, isn’t merged, etc.
|
|
||||||
|
|
||||||
#### `bool is_date() const`
|
|
||||||
Return true iff this cell’s number format matches a date format.
|
|
||||||
|
|
||||||
#### `cell_reference reference() const`
|
|
||||||
Return a cell_reference that points to the location of this cell.
|
|
||||||
|
|
||||||
#### `column_t column() const`
|
|
||||||
Return the column of this cell.
|
|
||||||
|
|
||||||
#### `row_t row() const`
|
|
||||||
Return the row of this cell.
|
|
||||||
|
|
||||||
#### `std::pair<int, int> anchor() const`
|
|
||||||
Return the location of this cell as an ordered pair.
|
|
||||||
|
|
||||||
#### `std::string hyperlink() const`
|
|
||||||
Return the URL of this cell’s hyperlink.
|
|
||||||
|
|
||||||
#### `void hyperlink(const std::string &value)`
|
|
||||||
Add a hyperlink to this cell pointing to the URI of the given value.
|
|
||||||
|
|
||||||
#### `bool has_hyperlink() const`
|
|
||||||
Return true if this cell has a hyperlink set.
|
|
||||||
|
|
||||||
#### `class alignment computed_alignment() const`
|
|
||||||
Returns the result of computed_format().alignment().
|
|
||||||
|
|
||||||
#### `class border computed_border() const`
|
|
||||||
Returns the result of computed_format().border().
|
|
||||||
|
|
||||||
#### `class fill computed_fill() const`
|
|
||||||
Returns the result of computed_format().fill().
|
|
||||||
|
|
||||||
#### `class font computed_font() const`
|
|
||||||
Returns the result of computed_format().font().
|
|
||||||
|
|
||||||
#### `class number_format computed_number_format() const`
|
|
||||||
Returns the result of computed_format().number_format().
|
|
||||||
|
|
||||||
#### `class protection computed_protection() const`
|
|
||||||
Returns the result of computed_format().protection().
|
|
||||||
|
|
||||||
#### `bool has_format() const`
|
|
||||||
Return true if this cell has had a format applied to it.
|
|
||||||
|
|
||||||
#### `const class format format() const`
|
|
||||||
Return a reference to the format applied to this cell. If this cell has no format, an invalid_attribute exception will be thrown.
|
|
||||||
|
|
||||||
#### `void format(const class format new_format)`
|
|
||||||
Applies the cell-level formatting of new_format to this cell.
|
|
||||||
|
|
||||||
#### `void clear_format()`
|
|
||||||
Remove the cell-level formatting from this cell. This doesn’t affect the style that may also be applied to the cell. Throws an invalid_attribute exception if no format is applied.
|
|
||||||
|
|
||||||
#### `class number_format number_format() const`
|
|
||||||
Returns the number format of this cell.
|
|
||||||
|
|
||||||
#### `void number_format(const class number_format &format)`
|
|
||||||
Creates a new format in the workbook, sets its number_format to the given format, and applies the format to this cell.
|
|
||||||
|
|
||||||
#### `class font font() const`
|
|
||||||
Returns the font applied to the text in this cell.
|
|
||||||
|
|
||||||
#### `void font(const class font &font_)`
|
|
||||||
Creates a new format in the workbook, sets its font to the given font, and applies the format to this cell.
|
|
||||||
|
|
||||||
#### `class fill fill() const`
|
|
||||||
Returns the fill applied to this cell.
|
|
||||||
|
|
||||||
#### `void fill(const class fill &fill_)`
|
|
||||||
Creates a new format in the workbook, sets its fill to the given fill, and applies the format to this cell.
|
|
||||||
|
|
||||||
#### `class border border() const`
|
|
||||||
Returns the border of this cell.
|
|
||||||
|
|
||||||
#### `void border(const class border &border_)`
|
|
||||||
Creates a new format in the workbook, sets its border to the given border, and applies the format to this cell.
|
|
||||||
|
|
||||||
#### `class alignment alignment() const`
|
|
||||||
Returns the alignment of the text in this cell.
|
|
||||||
|
|
||||||
#### `void alignment(const class alignment &alignment_)`
|
|
||||||
Creates a new format in the workbook, sets its alignment to the given alignment, and applies the format to this cell.
|
|
||||||
|
|
||||||
#### `class protection protection() const`
|
|
||||||
Returns the protection of this cell.
|
|
||||||
|
|
||||||
#### `void protection(const class protection &protection_)`
|
|
||||||
Creates a new format in the workbook, sets its protection to the given protection, and applies the format to this cell.
|
|
||||||
|
|
||||||
#### `bool has_style() const`
|
|
||||||
Returns true if this cell has had a style applied to it.
|
|
||||||
|
|
||||||
#### `const class style style() const`
|
|
||||||
Returns a wrapper pointing to the named style applied to this cell.
|
|
||||||
|
|
||||||
#### `void style(const class style &new_style)`
|
|
||||||
Equivalent to style(new_style.name())
|
|
||||||
|
|
||||||
#### `void style(const std::string &style_name)`
|
|
||||||
Sets the named style applied to this cell to a style named style_name. If this style has not been previously created in the workbook, a key_not_found exception will be thrown.
|
|
||||||
|
|
||||||
#### `void clear_style()`
|
|
||||||
Removes the named style from this cell. An invalid_attribute exception will be thrown if this cell has no style. This will not affect the cell format of the cell.
|
|
||||||
|
|
||||||
#### `std::string formula() const`
|
|
||||||
Returns the string representation of the formula applied to this cell.
|
|
||||||
|
|
||||||
#### `void formula(const std::string &formula)`
|
|
||||||
Sets the formula of this cell to the given value. This formula string should begin with ‘=’.
|
|
||||||
|
|
||||||
#### `void clear_formula()`
|
|
||||||
Removes the formula from this cell. After this is called, has_formula() will return false.
|
|
||||||
|
|
||||||
#### `bool has_formula() const`
|
|
||||||
Returns true if this cell has had a formula applied to it.
|
|
||||||
|
|
||||||
#### `std::string to_string() const`
|
|
||||||
Returns a string representing the value of this cell. If the data type is not a string, it will be converted according to the number format.
|
|
||||||
|
|
||||||
#### `bool is_merged() const`
|
|
||||||
Return true iff this cell has been merged with one or more surrounding cells.
|
|
||||||
|
|
||||||
#### `void merged(bool merged)`
|
|
||||||
Make this a merged cell iff merged is true. Generally, this shouldn’t be called directly. Instead, use worksheet::merge_cells on its parent worksheet.
|
|
||||||
|
|
||||||
#### `std::string error() const`
|
|
||||||
Return the error string that is stored in this cell.
|
|
||||||
|
|
||||||
#### `void error(const std::string &error)`
|
|
||||||
Directly assign the value of this cell to be the given error.
|
|
||||||
|
|
||||||
#### `cell offset(int column, int row)`
|
|
||||||
Return a cell from this cell’s parent workbook at a relative offset given by the parameters.
|
|
||||||
|
|
||||||
#### `class worksheet worksheet()`
|
|
||||||
Return the worksheet that owns this cell.
|
|
||||||
|
|
||||||
#### `const class worksheet worksheet() const`
|
|
||||||
Return the worksheet that owns this cell.
|
|
||||||
|
|
||||||
#### `class workbook &workbook()`
|
|
||||||
Return the workbook of the worksheet that owns this cell.
|
|
||||||
|
|
||||||
#### `const class workbook &workbook() const`
|
|
||||||
Return the workbook of the worksheet that owns this cell.
|
|
||||||
|
|
||||||
#### `calendar base_date() const`
|
|
||||||
Shortcut to return the base date of the parent workbook. Equivalent to workbook().properties().excel_base_date
|
|
||||||
|
|
||||||
#### `std::string check_string(const std::string &to_check)`
|
|
||||||
Return to_check after checking encoding, size, and illegal characters.
|
|
||||||
|
|
||||||
#### `bool has_comment()`
|
|
||||||
Return true if this cell has a comment applied.
|
|
||||||
|
|
||||||
#### `void clear_comment()`
|
|
||||||
Delete the comment applied to this cell if it exists.
|
|
||||||
|
|
||||||
#### `class comment comment()`
|
|
||||||
Get the comment applied to this cell.
|
|
||||||
|
|
||||||
#### `void comment(const std::string &text, const std::string &author = "Microsoft Office User")`
|
|
||||||
Create a new comment with the given text and optional author and apply it to the cell.
|
|
||||||
|
|
||||||
#### `void comment(const std::string &comment_text, const class font &comment_font, const std::string &author = "Microsoft Office User")`
|
|
||||||
Create a new comment with the given text, formatting, and optional author and apply it to the cell.
|
|
||||||
|
|
||||||
#### `void comment(const class comment &new_comment)`
|
|
||||||
Apply the comment provided as the only argument to the cell.
|
|
||||||
|
|
||||||
#### `cell &operator=(const cell &rhs)`
|
|
||||||
Make this cell point to rhs. The cell originally pointed to by this cell will be unchanged.
|
|
||||||
|
|
||||||
#### `bool operator==(const cell &comparand) const`
|
|
||||||
Return true if this cell the same cell as comparand (compare by reference).
|
|
||||||
|
|
||||||
#### `bool operator==(std::nullptr_t) const`
|
|
||||||
Return true if this cell is uninitialized.
|
|
||||||
|
|
||||||
#### `static const std::unordered_map<std::string, int> &error_codes()`
|
|
||||||
Return a map of error strings such as #DIV/0! and their associated indices.
|
|
||||||
|
|
||||||
### cell_reference class
|
|
||||||
|
|
||||||
#### `cell_reference()`
|
|
||||||
|
|
||||||
Default constructor makes a reference to the top-left-most cell, “A1”.
|
|
||||||
|
|
||||||
#### `cell_reference(const char *reference_string)`
|
|
||||||
|
|
||||||
Constructs a cell_reference from a string reprenting a cell coordinate (e.g. $B14).
|
|
||||||
|
|
||||||
## Workbook Module
|
|
||||||
|
|
||||||
### workbook class
|
|
||||||
|
|
||||||
#### `workbook::workbook()`
|
|
||||||
|
|
||||||
Constructs a workbook.
|
|
|
@ -13,8 +13,44 @@
|
||||||
|
|
||||||
## Compiling from Source
|
## Compiling from Source
|
||||||
|
|
||||||
### CMake
|
xlnt uses continous integration (thanks [Travis CI](https://travis-ci.org/) and [AppVeyor](https://www.appveyor.com/)!) and passes all 270+ tests in GCC 4, GCC 5, VS2015 U3, and Clang (using Apple LLVM 8.0). Build configurations for Visual Studio 2015, GNU Make, and Xcode can be created using [cmake](https://cmake.org/) v3.1+. A full list of cmake generators can be found [here](https://cmake.org/cmake/help/v3.0/manual/cmake-generators.7.html). A basic build would look like (starting in the root xlnt directory):
|
||||||
|
|
||||||
|
```bash
|
||||||
|
mkdir build
|
||||||
|
cd build
|
||||||
|
cmake ..
|
||||||
|
make -j8
|
||||||
|
```
|
||||||
|
|
||||||
|
The resulting shared (e.g. libxlnt.dylib) library would be found in the build/lib directory. Other cmake configuration options for xlnt can be found using "cmake -LH". These options include building a static library instead of shared and whether to build sample executables or not. An example of building a static library with an Xcode project:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
mkdir build
|
||||||
|
cd build
|
||||||
|
cmake -D STATIC=ON -G Xcode ..
|
||||||
|
cmake --build .
|
||||||
|
cd bin && ./xlnt.test
|
||||||
|
```
|
||||||
|
*Note for Windows: cmake defaults to building a 32-bit library project. To build a 64-bit library, use the Win64 generator*
|
||||||
|
```bash
|
||||||
|
cmake -G "Visual Studio 14 2015 Win64" ..
|
||||||
|
```
|
||||||
|
|
||||||
### Dependencies
|
### Dependencies
|
||||||
|
xlnt requires the following libraries which are all distributed under permissive open source licenses. All libraries are included in the source tree as [git submodules](https://git-scm.com/book/en/v2/Git-Tools-Submodules#Cloning-a-Project-with-Submodules) for convenience except for pole and partio's zip component which have been modified and reside in xlnt/source/detail:
|
||||||
|
- [zlib v1.2.8](http://zlib.net/) (zlib License)
|
||||||
|
- [libstudxml v1.1.0](http://www.codesynthesis.com/projects/libstudxml/) (MIT license)
|
||||||
|
- [utfcpp v2.3.4](http://utfcpp.sourceforge.net/) (Boost Software License, Version 1.0)
|
||||||
|
- [Crypto++ v5.6.5](https://www.cryptopp.com/) (Boost Software License, Version 1.0)
|
||||||
|
- [pole v0.5](https://github.com/catlan/pole) (BSD 2-Clause License)
|
||||||
|
- [partio v1.1.0](https://github.com/wdas/partio) (BSD 3-Clause License with specific non-attribution clause)
|
||||||
|
|
||||||
|
Additionally, the xlnt test suite (bin/xlnt.test) requires an extra testing library. This test executable is separate from the main xlnt library assembly so the terms of this library's license should not apply to users of solely the xlnt library:
|
||||||
|
- [cxxtest v4.4](http://cxxtest.com/) (LGPLv3 License)
|
||||||
|
|
||||||
|
Initialize the submodules from the HEAD of their respective Git repositories with this command called from the xlnt root directory:
|
||||||
|
```bash
|
||||||
|
git submodule update --init --remote
|
||||||
|
```
|
||||||
|
|
||||||
### Static vs. Dynamic
|
### Static vs. Dynamic
|
||||||
|
|
54
docs/source/includes/_properties.md
Normal file
54
docs/source/includes/_properties.md
Normal file
|
@ -0,0 +1,54 @@
|
||||||
|
# Properties
|
||||||
|
|
||||||
|
```c++
|
||||||
|
xlnt::workbook wb;
|
||||||
|
|
||||||
|
wb.core_property(xlnt::core_property::category, "hors categorie");
|
||||||
|
wb.core_property(xlnt::core_property::content_status, "good");
|
||||||
|
wb.core_property(xlnt::core_property::created, xlnt::datetime(2017, 1, 15));
|
||||||
|
wb.core_property(xlnt::core_property::creator, "me");
|
||||||
|
wb.core_property(xlnt::core_property::description, "description");
|
||||||
|
wb.core_property(xlnt::core_property::identifier, "id");
|
||||||
|
wb.core_property(xlnt::core_property::keywords, { "wow", "such" });
|
||||||
|
wb.core_property(xlnt::core_property::language, "Esperanto");
|
||||||
|
wb.core_property(xlnt::core_property::last_modified_by, "someone");
|
||||||
|
wb.core_property(xlnt::core_property::last_printed, xlnt::datetime(2017, 1, 15));
|
||||||
|
wb.core_property(xlnt::core_property::modified, xlnt::datetime(2017, 1, 15));
|
||||||
|
wb.core_property(xlnt::core_property::revision, "3");
|
||||||
|
wb.core_property(xlnt::core_property::subject, "subject");
|
||||||
|
wb.core_property(xlnt::core_property::title, "title");
|
||||||
|
wb.core_property(xlnt::core_property::version, "1.0");
|
||||||
|
|
||||||
|
wb.extended_property(xlnt::extended_property::application, "xlnt");
|
||||||
|
wb.extended_property(xlnt::extended_property::app_version, "0.9.3");
|
||||||
|
wb.extended_property(xlnt::extended_property::characters, 123);
|
||||||
|
wb.extended_property(xlnt::extended_property::characters_with_spaces, 124);
|
||||||
|
wb.extended_property(xlnt::extended_property::company, "Incorporated Inc.");
|
||||||
|
wb.extended_property(xlnt::extended_property::dig_sig, "?");
|
||||||
|
wb.extended_property(xlnt::extended_property::doc_security, 0);
|
||||||
|
wb.extended_property(xlnt::extended_property::heading_pairs, true);
|
||||||
|
wb.extended_property(xlnt::extended_property::hidden_slides, false);
|
||||||
|
wb.extended_property(xlnt::extended_property::h_links, 0);
|
||||||
|
wb.extended_property(xlnt::extended_property::hyperlink_base, 0);
|
||||||
|
wb.extended_property(xlnt::extended_property::hyperlinks_changed, true);
|
||||||
|
wb.extended_property(xlnt::extended_property::lines, 42);
|
||||||
|
wb.extended_property(xlnt::extended_property::links_up_to_date, false);
|
||||||
|
wb.extended_property(xlnt::extended_property::manager, "johnny");
|
||||||
|
wb.extended_property(xlnt::extended_property::m_m_clips, "?");
|
||||||
|
wb.extended_property(xlnt::extended_property::notes, "note");
|
||||||
|
wb.extended_property(xlnt::extended_property::pages, 19);
|
||||||
|
wb.extended_property(xlnt::extended_property::paragraphs, 18);
|
||||||
|
wb.extended_property(xlnt::extended_property::presentation_format, "format");
|
||||||
|
wb.extended_property(xlnt::extended_property::scale_crop, true);
|
||||||
|
wb.extended_property(xlnt::extended_property::shared_doc, false);
|
||||||
|
wb.extended_property(xlnt::extended_property::slides, 17);
|
||||||
|
wb.extended_property(xlnt::extended_property::template_, "template!");
|
||||||
|
wb.extended_property(xlnt::extended_property::titles_of_parts, { "title" });
|
||||||
|
wb.extended_property(xlnt::extended_property::total_time, 16);
|
||||||
|
wb.extended_property(xlnt::extended_property::words, 101);
|
||||||
|
|
||||||
|
wb.custom_property("test", { 1, 2, 3 });
|
||||||
|
wb.custom_property("Editor", "John Smith");
|
||||||
|
|
||||||
|
wb.save("lots_of_properties.xlsx");
|
||||||
|
```
|
|
@ -9,6 +9,7 @@ includes:
|
||||||
- getting_started
|
- getting_started
|
||||||
- memory_model
|
- memory_model
|
||||||
- formatting
|
- formatting
|
||||||
|
- properties
|
||||||
- api_reference
|
- api_reference
|
||||||
- license
|
- license
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user