From e9355262ab1d03311c351105c5f416feea395fe8 Mon Sep 17 00:00:00 2001 From: tfussell Date: Mon, 19 May 2014 17:34:35 -0400 Subject: [PATCH 1/3] Update readme with libraries and examples --- README.md | 53 +++++++++++++++++++++++++++++++++++++++++++++++------ 1 file changed, 47 insertions(+), 6 deletions(-) diff --git a/README.md b/README.md index 3bcc4ea6..2bf5d98c 100644 --- a/README.md +++ b/README.md @@ -5,6 +5,30 @@ Introduction ---- xlnt is a c++ library that reads and write XLSX files. The API is roughly based on openpyxl, a python XLSX library. It is still very much a work in progress, but I expect the basic functionality to be working in the near future. +Usage +---- +```c++ +xlnt::workbook wb; +xlnt::worksheet ws = wb.get_active_sheet(); +ws.cell("A1") = 5; +ws.cell("B2") = "string data"; +ws.cell("C3") = "=RAND()"; +ws.merge_cells("C3:C4"); +ws.freeze_panes("B2"); +wb.save("book1.xlsx"); + +xlnt::workbook wb2; +wb2.load("book2.xlsx"); +wb2["sheet1"].get_dimensions(); +for(auto &row : wb2["sheet2"]) +{ + for(auto cell : row) + { + std::cout << cell.to_string() << std::endl; + } +} +``` + Building ---- It compiles in all of the major compilers. Currently it is being built in GCC 4.8.2, MSVC 12, and Clang 3.3. @@ -14,12 +38,29 @@ Workspaces for Visual Studio, XCode, and GNU Make can be created using premake a Dependencies ---- xlnt requires the following libraries: -- [libopc v0.0.3 + mce + plib](http://libopc.codeplex.com/) - - [zlib v1.2.5](https://github.com/madler/zlib) - - [libxml2 v2.7.7](http://xmlsoft.org/index.html) - - [python v2.7+](https://www.python.org/) -- [pugixml v1.4](http://pugixml.org/) +- [zlib v1.2.8](http://zlib.net/) (zlib/libpng license) +- [pugixml v1.4](http://pugixml.org/) (MIT license) License ---- -xlnt is currently released under the terms of the MIT License. \ No newline at end of file +xlnt is currently released under the terms of the MIT License: + +Copyright (c) 2014 Thomas Fussell + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. From 7cd752613ae1de2e03d33c0aa4f52c176b9f43d4 Mon Sep 17 00:00:00 2001 From: tfussell Date: Mon, 19 May 2014 17:35:24 -0400 Subject: [PATCH 2/3] Add a description to examples --- README.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/README.md b/README.md index 2bf5d98c..67a7470b 100644 --- a/README.md +++ b/README.md @@ -7,6 +7,7 @@ xlnt is a c++ library that reads and write XLSX files. The API is roughly based Usage ---- +Create a new spreadsheet ```c++ xlnt::workbook wb; xlnt::worksheet ws = wb.get_active_sheet(); @@ -16,7 +17,10 @@ ws.cell("C3") = "=RAND()"; ws.merge_cells("C3:C4"); ws.freeze_panes("B2"); wb.save("book1.xlsx"); +``` +Open an existing spreadsheet +```c++ xlnt::workbook wb2; wb2.load("book2.xlsx"); wb2["sheet1"].get_dimensions(); From c61cee88f3f04a49b2e34c9a625de863ae79ce2a Mon Sep 17 00:00:00 2001 From: tfussell Date: Mon, 19 May 2014 17:37:00 -0400 Subject: [PATCH 3/3] Show how to include xlnt --- README.md | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/README.md b/README.md index 67a7470b..090647b9 100644 --- a/README.md +++ b/README.md @@ -7,6 +7,11 @@ xlnt is a c++ library that reads and write XLSX files. The API is roughly based Usage ---- +Using xlnt in your project +```c++ +#include +``` + Create a new spreadsheet ```c++ xlnt::workbook wb;