本文整理汇总了Python中xlsxwriter.sharedstrings.SharedStringTable类的典型用法代码示例。如果您正苦于以下问题:Python SharedStringTable类的具体用法?Python SharedStringTable怎么用?Python SharedStringTable使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了SharedStringTable类的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: __init__
def __init__(self, filename=None, options={}):
"""
Constructor.
"""
super(Workbook, self).__init__()
self.filename = filename
self.tmpdir = options.get('tmpdir', None)
self.date_1904 = options.get('date_1904', False)
self.strings_to_numbers = options.get('strings_to_numbers', False)
self.default_date_format = options.get('default_date_format', None)
self.worksheet_meta = WorksheetMeta()
self.selected = 0
self.fileclosed = 0
self.filehandle = None
self.internal_fh = 0
self.sheet_name = 'Sheet'
self.chart_name = 'Chart'
self.sheetname_count = 0
self.chartname_count = 0
self.worksheets_objs = []
self.charts = []
self.drawings = []
self.sheetnames = []
self.formats = []
self.xf_formats = []
self.xf_format_indices = {}
self.dxf_formats = []
self.dxf_format_indices = {}
self.palette = []
self.font_count = 0
self.num_format_count = 0
self.defined_names = []
self.named_ranges = []
self.custom_colors = []
self.doc_properties = {}
self.localtime = datetime.now()
self.num_vml_files = 0
self.num_comment_files = 0
self.optimization = options.get('constant_memory', 0)
self.x_window = 240
self.y_window = 15
self.window_width = 16095
self.window_height = 9660
self.tab_ratio = 500
self.str_table = SharedStringTable()
self.vba_project = None
self.vba_codename = None
self.image_types = {}
self.images = []
# Add the default cell format.
self.add_format({'xf_index': 0})
# Add the default date format.
if self.default_date_format is not None:
self.default_date_format = \
self.add_format({'num_format': self.default_date_format})
示例2: Workbook
class Workbook(xmlwriter.XMLwriter):
"""
A class for writing the Excel XLSX Workbook file.
"""
###########################################################################
#
# Public API.
#
###########################################################################
def __init__(self, filename=None, options={}):
"""
Constructor.
"""
super(Workbook, self).__init__()
self.filename = filename
self.tmpdir = options.get('tmpdir', None)
self.date_1904 = options.get('date_1904', False)
self.strings_to_numbers = options.get('strings_to_numbers', False)
self.strings_to_formulas = options.get('strings_to_formulas', True)
self.strings_to_urls = options.get('strings_to_urls', True)
self.default_date_format = options.get('default_date_format', None)
self.optimization = options.get('constant_memory', False)
self.in_memory = options.get('in_memory', False)
self.worksheet_meta = WorksheetMeta()
self.selected = 0
self.fileclosed = 0
self.filehandle = None
self.internal_fh = 0
self.sheet_name = 'Sheet'
self.chart_name = 'Chart'
self.sheetname_count = 0
self.chartname_count = 0
self.worksheets_objs = []
self.charts = []
self.drawings = []
self.sheetnames = []
self.formats = []
self.xf_formats = []
self.xf_format_indices = {}
self.dxf_formats = []
self.dxf_format_indices = {}
self.palette = []
self.font_count = 0
self.num_format_count = 0
self.defined_names = []
self.named_ranges = []
self.custom_colors = []
self.doc_properties = {}
self.localtime = datetime.now()
self.num_vml_files = 0
self.num_comment_files = 0
self.x_window = 240
self.y_window = 15
self.window_width = 16095
self.window_height = 9660
self.tab_ratio = 500
self.str_table = SharedStringTable()
self.vba_project = None
self.vba_codename = None
self.image_types = {}
self.images = []
self.border_count = 0
self.fill_count = 0
self.drawing_count = 0
# We can't do 'constant_memory' mode while doing 'in_memory' mode.
if self.in_memory:
self.optimization = False
# Add the default cell format.
self.add_format({'xf_index': 0})
# Add a default URL format.
self.default_url_format = self.add_format({'color': 'blue',
'underline': 1})
# Add the default date format.
if self.default_date_format is not None:
self.default_date_format = \
self.add_format({'num_format': self.default_date_format})
def __del__(self):
"""Close file in destructor if it hasn't been closed explicitly."""
if not self.fileclosed:
self.close()
def add_worksheet(self, name=None):
"""
Add a new worksheet to the Excel workbook.
Args:
name: The worksheet name. Defaults to 'Sheet1', etc.
#.........这里部分代码省略.........
示例3: __init__
def __init__(self, filename=None, options={}):
"""
Constructor.
"""
super(Workbook, self).__init__()
self.filename = filename
self.tmpdir = options.get('tmpdir', None)
self.date_1904 = options.get('date_1904', False)
self.strings_to_numbers = options.get('strings_to_numbers', False)
self.strings_to_formulas = options.get('strings_to_formulas', True)
self.strings_to_urls = options.get('strings_to_urls', True)
self.default_date_format = options.get('default_date_format', None)
self.optimization = options.get('constant_memory', False)
self.in_memory = options.get('in_memory', False)
self.excel2003_style = options.get('excel2003_style', False)
self.default_format_properties = \
options.get('default_format_properties', {})
self.worksheet_meta = WorksheetMeta()
self.selected = 0
self.fileclosed = 0
self.filehandle = None
self.internal_fh = 0
self.sheet_name = 'Sheet'
self.chart_name = 'Chart'
self.sheetname_count = 0
self.chartname_count = 0
self.worksheets_objs = []
self.charts = []
self.drawings = []
self.sheetnames = []
self.formats = []
self.xf_formats = []
self.xf_format_indices = {}
self.dxf_formats = []
self.dxf_format_indices = {}
self.palette = []
self.font_count = 0
self.num_format_count = 0
self.defined_names = []
self.named_ranges = []
self.custom_colors = []
self.doc_properties = {}
self.localtime = datetime.now()
self.num_vml_files = 0
self.num_comment_files = 0
self.x_window = 240
self.y_window = 15
self.window_width = 16095
self.window_height = 9660
self.tab_ratio = 500
self.str_table = SharedStringTable()
self.vba_project = None
self.vba_codename = None
self.image_types = {}
self.images = []
self.border_count = 0
self.fill_count = 0
self.drawing_count = 0
self.calc_mode = "auto"
self.calc_on_load = True
self.allow_zip64 = False
self.calc_id = 124519
# We can't do 'constant_memory' mode while doing 'in_memory' mode.
if self.in_memory:
self.optimization = False
# Add the default cell format.
if self.excel2003_style:
self.add_format({'xf_index': 0, 'font_family': 0})
else:
self.add_format({'xf_index': 0})
# Add a default URL format.
self.default_url_format = self.add_format({'color': 'blue',
'underline': 1})
# Add the default date format.
if self.default_date_format is not None:
self.default_date_format = \
self.add_format({'num_format': self.default_date_format})
示例4: Workbook
class Workbook(xmlwriter.XMLwriter):
"""
A class for writing the Excel XLSX Workbook file.
"""
###########################################################################
#
# Public API.
#
###########################################################################
def __init__(self, filename=None, options={}):
"""
Constructor.
"""
super(Workbook, self).__init__()
self.filename = filename
self.tmpdir = options.get("tmpdir", None)
self.date_1904 = options.get("date_1904", False)
self.strings_to_numbers = options.get("strings_to_numbers", False)
self.strings_to_formulas = options.get("strings_to_formulas", True)
self.strings_to_urls = options.get("strings_to_urls", True)
self.nan_inf_to_errors = options.get("nan_inf_to_errors", False)
self.default_date_format = options.get("default_date_format", None)
self.optimization = options.get("constant_memory", False)
self.in_memory = options.get("in_memory", False)
self.excel2003_style = options.get("excel2003_style", False)
self.default_format_properties = options.get("default_format_properties", {})
self.worksheet_meta = WorksheetMeta()
self.selected = 0
self.fileclosed = 0
self.filehandle = None
self.internal_fh = 0
self.sheet_name = "Sheet"
self.chart_name = "Chart"
self.sheetname_count = 0
self.chartname_count = 0
self.worksheets_objs = []
self.charts = []
self.drawings = []
self.sheetnames = []
self.formats = []
self.xf_formats = []
self.xf_format_indices = {}
self.dxf_formats = []
self.dxf_format_indices = {}
self.palette = []
self.font_count = 0
self.num_format_count = 0
self.defined_names = []
self.named_ranges = []
self.custom_colors = []
self.doc_properties = {}
self.localtime = datetime.now()
self.num_vml_files = 0
self.num_comment_files = 0
self.x_window = 240
self.y_window = 15
self.window_width = 16095
self.window_height = 9660
self.tab_ratio = 500
self.str_table = SharedStringTable()
self.vba_project = None
self.vba_is_stream = False
self.vba_codename = None
self.image_types = {}
self.images = []
self.border_count = 0
self.fill_count = 0
self.drawing_count = 0
self.calc_mode = "auto"
self.calc_on_load = True
self.allow_zip64 = False
self.calc_id = 124519
# We can't do 'constant_memory' mode while doing 'in_memory' mode.
if self.in_memory:
self.optimization = False
# Add the default cell format.
if self.excel2003_style:
self.add_format({"xf_index": 0, "font_family": 0})
else:
self.add_format({"xf_index": 0})
# Add a default URL format.
self.default_url_format = self.add_format({"color": "blue", "underline": 1})
# Add the default date format.
if self.default_date_format is not None:
self.default_date_format = self.add_format({"num_format": self.default_date_format})
def __del__(self):
#.........这里部分代码省略.........
示例5: Workbook
class Workbook(xmlwriter.XMLwriter):
"""
A class for writing the Excel XLSX Workbook file.
"""
###########################################################################
#
# Public API.
#
###########################################################################
def __init__(self, filename=None, options={}):
"""
Constructor.
"""
super(Workbook, self).__init__()
self.filename = filename
self.tmpdir = options.get("tmpdir", None)
self.date_1904 = options.get("date_1904", False)
self.strings_to_numbers = options.get("strings_to_numbers", True)
self.default_date_format = options.get("default_date_format", None)
self.worksheet_meta = WorksheetMeta()
self.selected = 0
self.fileclosed = 0
self.filehandle = None
self.internal_fh = 0
self.sheet_name = "Sheet"
self.chart_name = "Chart"
self.sheetname_count = 0
self.chartname_count = 0
self.worksheets_objs = []
self.charts = []
self.drawings = []
self.sheetnames = []
self.formats = []
self.xf_formats = []
self.xf_format_indices = {}
self.dxf_formats = []
self.dxf_format_indices = {}
self.palette = []
self.font_count = 0
self.num_format_count = 0
self.defined_names = []
self.named_ranges = []
self.custom_colors = []
self.doc_properties = {}
self.localtime = datetime.now()
self.num_vml_files = 0
self.num_comment_files = 0
self.optimization = options.get("constant_memory", 0)
self.x_window = 240
self.y_window = 15
self.window_width = 16095
self.window_height = 9660
self.tab_ratio = 500
self.str_table = SharedStringTable()
self.vba_project = None
self.vba_codename = None
self.image_types = {}
self.images = []
# Add the default cell format.
self.add_format({"xf_index": 0})
# Add the default date format.
if self.default_date_format is not None:
self.default_date_format = self.add_format({"num_format": self.default_date_format})
def __del__(self):
"""Close file in destructor if it hasn't been closed explicitly."""
if not self.fileclosed:
self.close()
def add_worksheet(self, name=None):
"""
Add a new worksheet to the Excel workbook.
Args:
name: The worksheet name. Defaults to 'Sheet1', etc.
Returns:
Reference to a worksheet object.
"""
sheet_index = len(self.worksheets_objs)
name = self._check_sheetname(name)
# Initialisation data to pass to the worksheet.
init_data = {
"name": name,
"index": sheet_index,
"str_table": self.str_table,
"worksheet_meta": self.worksheet_meta,
"optimization": self.optimization,
"tmpdir": self.tmpdir,
#.........这里部分代码省略.........
示例6: __init__
def __init__(self, filename=None, options={}):
"""
Constructor.
"""
super(Workbook, self).__init__()
self.filename = filename
self.tmpdir = options.get("tmpdir", None)
self.date_1904 = options.get("date_1904", False)
self.strings_to_numbers = options.get("strings_to_numbers", False)
self.strings_to_formulas = options.get("strings_to_formulas", True)
self.strings_to_urls = options.get("strings_to_urls", True)
self.default_date_format = options.get("default_date_format", None)
self.optimization = options.get("constant_memory", False)
self.in_memory = options.get("in_memory", False)
self.worksheet_meta = WorksheetMeta()
self.selected = 0
self.fileclosed = 0
self.filehandle = None
self.internal_fh = 0
self.sheet_name = "Sheet"
self.chart_name = "Chart"
self.sheetname_count = 0
self.chartname_count = 0
self.worksheets_objs = []
self.charts = []
self.drawings = []
self.sheetnames = []
self.formats = []
self.xf_formats = []
self.xf_format_indices = {}
self.dxf_formats = []
self.dxf_format_indices = {}
self.palette = []
self.font_count = 0
self.num_format_count = 0
self.defined_names = []
self.named_ranges = []
self.custom_colors = []
self.doc_properties = {}
self.localtime = datetime.now()
self.num_vml_files = 0
self.num_comment_files = 0
self.x_window = 240
self.y_window = 15
self.window_width = 16095
self.window_height = 9660
self.tab_ratio = 500
self.str_table = SharedStringTable()
self.vba_project = None
self.vba_codename = None
self.image_types = {}
self.images = []
self.border_count = 0
self.fill_count = 0
self.drawing_count = 0
self.calc_mode = "auto"
self.calc_on_load = True
# We can't do 'constant_memory' mode while doing 'in_memory' mode.
if self.in_memory:
self.optimization = False
# Add the default cell format.
self.add_format({"xf_index": 0})
# Add a default URL format.
self.default_url_format = self.add_format({"color": "blue", "underline": 1})
# Add the default date format.
if self.default_date_format is not None:
self.default_date_format = self.add_format({"num_format": self.default_date_format})