From 85c5a0fd672c803fa72bd5612e61106523bc75bd Mon Sep 17 00:00:00 2001 From: Yasunobu Okamura Date: Sat, 22 Jun 2024 15:55:30 +0900 Subject: [PATCH] remove deprecated api from README --- README.md | 22 ++++++---------------- 1 file changed, 6 insertions(+), 16 deletions(-) diff --git a/README.md b/README.md index 25b8827..cfd893a 100644 --- a/README.md +++ b/README.md @@ -47,31 +47,21 @@ Example ![Result Image](images/simple1.png) ```rust -let workbook = Workbook::new("target/simple1.xlsx")?; -let format1 = workbook.add_format().set_font_color(FormatColor::Red); - -let format2 = workbook - .add_format() - .set_font_color(FormatColor::Blue) - .set_underline(FormatUnderline::Single); - -let format3 = workbook - .add_format() - .set_font_color(FormatColor::Green) - .set_align(FormatAlignment::CenterAcross) - .set_align(FormatAlignment::VerticalCenter); +let workbook = Workbook::new("simple1.xlsx")?; let mut sheet1 = workbook.add_worksheet(None)?; -sheet1.write_string(0, 0, "Red text", Some(&format1))?; +sheet1.write_string(0, 0, "Red text", Some(&Format::new().set_font_color(FormatColor::Red)))?; sheet1.write_number(0, 1, 20., None)?; sheet1.write_formula_num(1, 0, "=10+B1", None, 30.)?; sheet1.write_url( 1, 1, "https://github.com/informationsea/xlsxwriter-rs", - Some(&format2), + Some(&Format::new().set_font_color(FormatColor::Blue).set_underline(FormatUnderline::Single)), )?; -sheet1.merge_range(2, 0, 3, 2, "Hello, world", Some(&format3))?; +sheet1.merge_range(2, 0, 3, 2, "Hello, world", Some( + &Format::new().set_font_color(FormatColor::Green).set_align(FormatAlignment::CenterAcross) + .set_vertical_align(FormatVerticalAlignment::VerticalCenter)))?; sheet1.set_selection(1, 0, 1, 2); sheet1.set_tab_color(FormatColor::Cyan);