libxlsxwriter/docs/src/examples.txt
2021-08-22 19:30:31 +01:00

605 lines
16 KiB
Text

##############################################################
@example hello.c
The simplest possible program and spreadsheet. This is a good place to start
to see if the libxlsxwriter library is installed and working correctly.
@image html hello01.png
##############################################################
@example anatomy.c
Anatomy of a simple libxlsxwriter program where the program is explained line
by line with comments.
@image html anatomy.png
##############################################################
@example demo.c
A simple example of some of the features of the libxlsxwriter library.
@image html demo.png
##############################################################
@example format_font.c
Example of writing some data with font formatting to a simple Excel
file using libxlsxwriter.
@image html format_font.png
##############################################################
@example format_num_format.c
Example of writing some data with numeric formatting to a simple Excel
file using libxlsxwriter.
@image html format_set_num_format.png
##############################################################
@example tutorial1.c
A tutorial program which is shown, with explanations, in @ref tutorial01.
@image html tutorial01.png
##############################################################
@example tutorial2.c
A tutorial program which is shown, with explanations, in @ref tutorial02.
@image html tutorial02.png
##############################################################
@example tutorial3.c
A tutorial program which is shown, with explanations, in @ref tutorial03.
@image html tutorial03.png
##############################################################
@example dates_and_times01.c
Example of writing a dates and time in Excel using a number with date
formatting. This demonstrates that dates and times in Excel are just formatted
real numbers. An easier approach using a lxw_datetime struct is shown in the
next example.
@image html date_example01.png
##############################################################
@example dates_and_times02.c
Example of writing dates and times in Excel using an lxw_datetime struct and
date formatting.
@image html date_example02.png
##############################################################
@example dates_and_times03.c
Example of writing dates and times in Excel using Unix datetimes and
formatting.
@image html date_example03.png
##############################################################
@example dates_and_times04.c
Example of writing dates and times in Excel using different date formats.
@image html date_example04.png
##############################################################
@example hyperlinks.c
Example of writing urls/hyperlinks to a worksheet.
@image html hyperlinks.png
##############################################################
@example rich_strings.c
Example of writing "rich" multi-format strings to a worksheet.
@image html rich_strings.png
##############################################################
@example array_formula.c
Example of writing array formulas to a worksheet.
@image html array_formula.png
##############################################################
@example dynamic_arrays.c
Example of writing Excel 365 dynamic array formulas to a worksheet.
@image html dynamic_arrays01.png
##############################################################
@example utf8.c
A simple Unicode UTF-8 example. Note, the source file is UTF-8 encoded.
@image html utf8.png
##############################################################
@example constant_memory.c
Example of using libxlsxwriter for writing large files in constant memory
mode.
@image html constant_memory.png
##############################################################
@example merge_range.c
Example of merging cells in a worksheet.
@image html merge_range.png
##############################################################
@example merge_rich_string.c
Example of merging cells with a rich string in a worksheet.
@image html merge_rich.png
##############################################################
@example autofilter.c
Example of adding autofilters to a worksheets and adding filter conditions.
@image html autofilter3.png
##############################################################
@example data_validate.c
Example of adding data validations to a worksheet.
@image html data_validate4.png
##############################################################
@example conditional_format1.c
A simple example of how to add a conditional format a
libxlsxwriter file. Conditional formatting allows you to apply
a format to a cell or a range of cells based on certain criteria.
@image html conditional_format12.png
##############################################################
@example conditional_format2.c
A more comprehensive example of how to add conditional formatting
to an libxlsxwriter file. Conditional formatting allows you to
apply a format to a cell or a range of cells based on certain
criteria.
@image html conditional_format1.png
##############################################################
@example tables.c
Example of how to add tables to a worksheet. Tables in Excel are used to group
rows and columns of data into a single structure that can be referenced in a
formula or formatted collectively.
@image html tables12.png
##############################################################
@example images.c
Example of adding images to a worksheet.
@image html images.png
##############################################################
@example image_buffer.c
Example of adding an image to a worksheet from a memory buffer.
@image html image_buffer2.png
##############################################################
@example headers_footers.c
Example of adding worksheet headers and footers to worksheets.
@image html headers_footers.png
##############################################################
@example defined_name.c
Example of how to create defined names (named ranges) using libxlsxwriter.
Defined names are used to define descriptive names to represent a value, a
single cell or a range of cells in a workbook or worksheet.
@image html defined_name.png
##############################################################
@example outline.c
Example of how to generate Excel outlines and grouping.
@image html outline1.png
##############################################################
@example outline_collapsed.c
Example of how to generate Excel outlines and grouping. These examples focus
mainly on collapsed outlines.
@image html outline2.png
##############################################################
@example background.c
Example of how to set the background image for a worksheet.
@image html background.png
##############################################################
@example tab_colors.c
Example of how to set Excel worksheet tab colors.
@image html tab_colors.png
##############################################################
@example diagonal_border.c
Example of how to set a worksheet cell diagonal border.
@image html diagonal_border.png
##############################################################
@example hide_sheet.c
Example of how to hide an Excel worksheet.
@image html hide_sheet.png
##############################################################
@example doc_properties.c
Example of setting Excel document properties.
@image html doc_properties.png
##############################################################
@example doc_custom_properties.c
Example of setting Excel custom document properties, i.e., properties
non-standard document properties.
@image html custom_properties.png
##############################################################
@example worksheet_protection.c
Example of setting Excel worksheet protection.
@image html worksheet_protection.png
##############################################################
@example macro.c
Example adding a VBA macro to a workbook.
@image html macros.png
##############################################################
@example comments1.c
A simple example of adding cell comments to a worksheet.
@image html comments1.png
##############################################################
@example comments2.c
Another example of adding cell comments to a worksheet. This example
demonstrates most of the available comment formatting options.
@image html comments2.png
##############################################################
@example hide_row_col.c
Example of hiding rows and columns in an Excel worksheet.
@image html hide_row_col.png
##############################################################
@example panes.c
An example of how to create panes in a worksheet, both "freeze" panes and
"split" panes.
@image html panes.png
##############################################################
@example ignore_errors.c
Example of hiding worksheet errors and warnings.
@image html ignore_errors2.png
##############################################################
@example lambda.c
Example of using the new Excel `LAMBDA()` function. It demonstrates how to
create a lambda function in Excel and also how to assign a name to it so that
it can be called as a user defined function. This particular example converts
from Fahrenheit to Celsius. Note, this function is only currently available if
you are subscribed to the Microsoft Office Beta Channel program.
@image html lambda01.png
##############################################################
@example chart.c
An example of creating a simple column chart with 3 data series.
@image html chart_simple.png
##############################################################
@example chart_area.c
Example of creating Excel Area charts. Three types of area chart are shown.
The default area chart:
@image html chart_area1.png
Stacked area chart:
@image html chart_area2.png
Percent stacked area chart:
@image html chart_area3.png
##############################################################
@example chart_bar.c
Example of creating Excel Bar charts. Three types of bar chart are shown.
The default bar chart:
@image html chart_bar1.png
Stacked bar chart:
@image html chart_bar2.png
Percent stacked bar chart:
@image html chart_bar3.png
##############################################################
@example chart_column.c
Example of creating Excel Column charts. Three types of column chart are shown.
The default column chart:
@image html chart_column1.png
Stacked column chart:
@image html chart_column2.png
Percent stacked column chart:
@image html chart_column3.png
##############################################################
@example chart_line.c
Example of creating Excel Line charts. Three types of line chart are shown.
The default line chart:
@image html chart_line1.png
Stacked line chart:
@image html chart_line2.png
Percent stacked line chart:
@image html chart_line3.png
##############################################################
@example chart_scatter.c
Example of creating Excel Scatter charts. Five types of scatter chart are shown.
The default scatter chart:
@image html chart_scatter1.png
Straight scatter chart with markers:
@image html chart_scatter2.png
Straight scatter chart:
@image html chart_scatter3.png
Smooth scatter chart with markers:
@image html chart_scatter4.png
Smooth scatter chart:
@image html chart_scatter5.png
##############################################################
@example chart_radar.c
Example of creating Excel Radar charts. Three types of radar chart are shown.
The default radar chart:
@image html chart_radar1.png
Radar chart with markers:
@image html chart_radar2.png
Filled radar chart:
@image html chart_radar3.png
##############################################################
@example chart_pie.c
Examples of creating an Excel Pie chart.
The default pie chart:
@image html chart_pie1.png
A pie chart with user defined colors:
@image html chart_pie2.png
A pie chart with rotated segments:
@image html chart_pie3.png
##############################################################
@example chart_doughnut.c
Example of creating an Excel Doughnut chart.
The default doughnut chart:
@image html chart_doughnut1.png
It is possible to define chart colors for most types of libxlsxwriter charts
via the series formatting functions. However, Pie/Doughnut charts are a
special case since each segment is represented as a point so it is necessary
to assign formatting to each point in the series.
Chart 4 shows how to set segment colors and other options.
@image html chart_doughnut2.png
##############################################################
@example chart_clustered.c
Example of creating a clustered Excel chart where there are two levels of
category on the X axis.
The categories in clustered charts are 2D ranges, instead of the more normal
1D ranges. The series are shown as formula strings for clarity but you can
also use the a list syntax.
@image html chart_clustered.png
##############################################################
@example chart_data_table.c
Example of creating charts with data tables.
Chart 1 in the following example is a column chart with default data table:
@image html chart_data_table1.png
Chart 2 is a column chart with default data table with legend keys:
@image html chart_data_table2.png
##############################################################
@example chart_data_tools.c
A demo of an various Excel chart data tools that are available via a
libxlsxwriter chart. These include Drop Lines and High-Low Lines.
Chart 1: chart with high-low lines.
@image html chart_data_tools5.png
Chart 2: chart with drop lines.
@image html chart_data_tools6.png
Chart 3: chart with up-down bars.
@image html chart_data_tools4.png
Chart 4: chart with formatted Up-down bars.
@image html chart_data_tools7.png
Chart 5: chart with markers and data labels.
@image html chart_data_tools8.png
Chart 6: chart with error bars.
@image html chart_data_tools3.png
Chart 7: chart with a trendline.
@image html chart_data_tools9.png
##############################################################
@example chart_data_labels.c
A demo of an various Excel chart data label features that are available via a
libxlsxwriter chart, including custom data labels.
Chart 1: chart with standard data labels.
@image html chart_data_labels11.png
Chart 2: chart with Category and Value data labels.
@image html chart_data_labels12.png
Chart 3: chart with data labels with a user defined font.
@image html chart_data_labels13.png
Chart 4: chart with data labels and formatting.
@image html chart_data_labels22.png
Chart 5: chart with custom string data labels.
@image html chart_data_labels14.png
Chart 6: chart with custom data labels referenced from worksheet cells.
@image html chart_data_labels15.png
Chart 7: chart with a mix of custom and default labels. The items initialized
with '{0}' and items without a custom label (points 5 and 6 which come after
NULL) will get the default value. We also set a font for the custom items as
an extra example.
@image html chart_data_labels16.png
Chart 8: chart with some deleted custom labels and defaults.
@image html chart_data_labels17.png
Chart 9: chart with custom string data labels and formatting.
@image html chart_data_labels23.png
##############################################################
@example chart_fonts.c
An example of creating a simple chart with different fonts.
@image html chart_fonts.png
##############################################################
@example chart_pattern.c
An example of creating a simple chart with different patterns.
@image html chart_pattern.png
##############################################################
@example chart_styles.c
An example showing all 48 default chart styles available in Excel 2007 using
the chart `chart_set_style()` method.
@image html chart_styles.png
##############################################################
@example chartsheet.c
An example of creating a simple bar chart in a chartsheet.
@image html chartsheet.png