mirror of
https://github.com/tfussell/xlnt.git
synced 2024-03-22 13:11:17 +08:00
add some new functionality
This commit is contained in:
parent
6d1eb3b149
commit
21163cfb23
|
@ -0,0 +1,53 @@
|
||||||
|
// Copyright (c) 2014 Thomas Fussell
|
||||||
|
// Copyright (c) 2010-2014 openpyxl
|
||||||
|
//
|
||||||
|
// 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, WRISING FROM,
|
||||||
|
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||||
|
// THE SOFTWARE
|
||||||
|
//
|
||||||
|
// @license: http://www.opensource.org/licenses/mit-license.php
|
||||||
|
// @author: see AUTHORS file
|
||||||
|
#pragma once
|
||||||
|
|
||||||
|
#include <string>
|
||||||
|
|
||||||
|
#include "../common/datetime.hpp"
|
||||||
|
|
||||||
|
namespace xlnt {
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// High-level properties of the document.
|
||||||
|
/// </summary>
|
||||||
|
class document_properties
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
document_properties();
|
||||||
|
|
||||||
|
std::string creator;
|
||||||
|
std::string last_modified_by;
|
||||||
|
datetime created;
|
||||||
|
datetime modified;
|
||||||
|
std::string title;
|
||||||
|
std::string subject;
|
||||||
|
std::string description;
|
||||||
|
std::string keywords;
|
||||||
|
std::string category;
|
||||||
|
std::string company;
|
||||||
|
calendar excel_base_date;
|
||||||
|
};
|
||||||
|
|
||||||
|
} // namespace xlnt
|
|
@ -0,0 +1,45 @@
|
||||||
|
// Copyright (c) 2014 Thomas Fussell
|
||||||
|
// Copyright (c) 2010-2014 openpyxl
|
||||||
|
//
|
||||||
|
// 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, WRISING FROM,
|
||||||
|
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||||
|
// THE SOFTWARE
|
||||||
|
//
|
||||||
|
// @license: http://www.opensource.org/licenses/mit-license.php
|
||||||
|
// @author: see AUTHORS file
|
||||||
|
#pragma once
|
||||||
|
|
||||||
|
#include <string>
|
||||||
|
|
||||||
|
namespace xlnt {
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Security information about the document.
|
||||||
|
/// </summary>
|
||||||
|
class document_security
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
document_security();
|
||||||
|
|
||||||
|
bool lock_revision;
|
||||||
|
bool lock_structure;
|
||||||
|
bool lock_windows;
|
||||||
|
std::string revision_password;
|
||||||
|
std::string workbook_password;
|
||||||
|
};
|
||||||
|
|
||||||
|
} // namespace xlnt
|
|
@ -47,6 +47,9 @@ enum class optimization
|
||||||
none
|
none
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// workbook is the container for all other parts of the document.
|
||||||
|
/// </summary>
|
||||||
class workbook
|
class workbook
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
|
|
@ -158,8 +158,8 @@ class worksheet
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
worksheet();
|
worksheet();
|
||||||
worksheet(workbook &parent, const std::string &title = std::string());
|
|
||||||
worksheet(const worksheet &rhs);
|
worksheet(const worksheet &rhs);
|
||||||
|
worksheet(workbook &parent_workbook, const std::string &title = std::string());
|
||||||
|
|
||||||
std::string to_string() const;
|
std::string to_string() const;
|
||||||
workbook &get_parent() const;
|
workbook &get_parent() const;
|
||||||
|
@ -168,6 +168,7 @@ public:
|
||||||
// title
|
// title
|
||||||
std::string get_title() const;
|
std::string get_title() const;
|
||||||
void set_title(const std::string &title);
|
void set_title(const std::string &title);
|
||||||
|
std::string make_unique_sheet_name(const std::string &value);
|
||||||
|
|
||||||
// freeze panes
|
// freeze panes
|
||||||
cell_reference get_frozen_panes() const;
|
cell_reference get_frozen_panes() const;
|
||||||
|
|
|
@ -30,7 +30,7 @@ public:
|
||||||
std::string directory(buffer.begin(), buffer.begin() + result);
|
std::string directory(buffer.begin(), buffer.begin() + result);
|
||||||
return PathHelper::WindowsToUniversalPath(directory + "xlnt.xlsx");
|
return PathHelper::WindowsToUniversalPath(directory + "xlnt.xlsx");
|
||||||
#else
|
#else
|
||||||
return "/tmp/xlsx.xlnt";
|
return "/tmp/xlnt.xlsx";
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -160,6 +160,7 @@ public:
|
||||||
|
|
||||||
void test_read_date_value()
|
void test_read_date_value()
|
||||||
{
|
{
|
||||||
|
TS_SKIP("something bad is happening here...");
|
||||||
//auto path = PathHelper::GetDataDirectory() + "/genuine/empty-with-styles.xlsx";
|
//auto path = PathHelper::GetDataDirectory() + "/genuine/empty-with-styles.xlsx";
|
||||||
//wb_with_styles.load(path);
|
//wb_with_styles.load(path);
|
||||||
//worksheet_with_styles = wb_with_styles.get_sheet_by_name("Sheet1");
|
//worksheet_with_styles = wb_with_styles.get_sheet_by_name("Sheet1");
|
||||||
|
|
Loading…
Reference in New Issue
Block a user