FIX: Export views and showGridLines properly (#72)

This commit is contained in:
Nicolás Hatcher Andrés
2024-05-28 21:52:10 +02:00
committed by GitHub
parent b37397acb8
commit c3a9b006d2
4 changed files with 98 additions and 17 deletions

View File

@@ -34,7 +34,7 @@ use ironcalc_base::types::{SheetState, Workbook};
use super::escape::escape_xml;
use super::xml_constants::XML_DECLARATION;
pub(crate) fn get_workbook_xml(workbook: &Workbook) -> String {
pub(crate) fn get_workbook_xml(workbook: &Workbook, selected_sheet: u32) -> String {
// sheets
// <sheet name="Sheet1" sheetId="1" r:id="rId1"/>
let mut sheets_str: Vec<String> = vec![];
@@ -80,6 +80,9 @@ pub(crate) fn get_workbook_xml(workbook: &Workbook) -> String {
let defined_names = defined_names_str.join("");
format!("{XML_DECLARATION}\n\
<workbook xmlns=\"http://schemas.openxmlformats.org/spreadsheetml/2006/main\" xmlns:r=\"http://schemas.openxmlformats.org/officeDocument/2006/relationships\">\
<bookViews>
<workbookView activeTab=\"{selected_sheet}\"/>\
</bookViews>
<sheets>\
{sheets}\
</sheets>\