diff --git a/README.md b/README.md index 6c72135..5be2ead 100644 --- a/README.md +++ b/README.md @@ -8,6 +8,20 @@ **libfort** is a simple crossplatform library to create formatted text tables. + + **Features:** - Easy to integrate (only 2 files) - Customization of appearance (various border styles and row/column/cell options for indentation, alignment, padding) @@ -263,3 +277,7 @@ The above copyright notice and this permission notice shall be included in all c 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. + + + + diff --git a/docs/images/carbon2.png b/docs/images/carbon2.png new file mode 100644 index 0000000..40964fa Binary files /dev/null and b/docs/images/carbon2.png differ diff --git a/example/main.c b/example/main.c index c857408..3ba495f 100644 --- a/example/main.c +++ b/example/main.c @@ -47,6 +47,31 @@ void base_example(void) ft_destroy_table(table); } +void complex_layout_example(void) +{ + ft_table_t *table = ft_create_table(); + /* Change border style */ + ft_set_border_style(table, FT_DOUBLE2_STYLE); + + + ft_set_cell_option(table, 0, FT_ANY_COLUMN, FT_COPT_ROW_TYPE, FT_ROW_HEADER); + ft_write_ln(table, "Sed", "Aenean", "Text"); + + ft_write_ln(table, "Duis", "Aliquam", + "Lorem ipsum dolor sit amet, consectetur adipiscing elit.\n" + "In accumsan felis eros, nec malesuada sapien bibendum eget."); + ft_write_ln(table, "Mauris", "Curabitur", + "Proin condimentum eros viverra nunc ultricies, at fringilla \n" + "quam pellentesque."); + ft_write_ln(table, "Summary", "", "Sed tempor est eget odio varius dignissim."); + + ft_set_cell_option(table, 0, 2, FT_COPT_TEXT_ALIGN, FT_ALIGNED_CENTER); + ft_set_cell_option(table, 3, 0, FT_COPT_TEXT_ALIGN, FT_ALIGNED_CENTER); + ft_set_cell_span(table, 3, 0, 2); + printf("%s\n", ft_to_string(table)); + ft_destroy_table(table); +} + void different_cell_options_example(void) { ft_table_t *table = ft_create_table(); @@ -95,6 +120,7 @@ int main(void) base_example(); different_cell_options_example(); fill_table_with_data_example(); + complex_layout_example(); int result = 0;