excelize/
xml_workbook.rs

1// Copyright 2021 The excelize Authors. All rights reserved. Use of
2// this source code is governed by a BSD-style license that can be found in
3// the LICENSE file.
4
5use serde::Deserialize;
6use serde::Serialize;
7
8/// XMLWorkbook contains elements and attributes that encompass the data
9/// content of the workbook. The workbook's child elements each have their own
10/// subclause references.
11#[derive(Debug, Deserialize, Serialize, PartialEq)]
12#[serde(rename = "workbook")]
13pub struct XMLWorkbook {
14    #[serde(rename = "fileVersion")]
15    pub file_version: XMLFileVersion,
16    #[serde(rename = "sheets")]
17    pub sheets: XMLSheets,
18}
19
20/// XMLFileVersion directly maps the fileVersion element. This element defines
21/// properties that track which version of the application accessed the data and
22/// source code contained in the file.
23#[derive(Debug, Deserialize, Serialize, PartialEq)]
24#[serde(rename = "fileVersion")]
25pub struct XMLFileVersion {
26    #[serde(rename = "appName")]
27    pub app_name: String,
28    #[serde(rename = "lastEdited")]
29    pub last_edited: i32,
30    #[serde(rename = "lowestEdited")]
31    pub lowest_edited: i32,
32    #[serde(rename = "rupBuild")]
33    pub rup_build: i32,
34}
35
36/// XMLSheets directly maps the sheets element from the namespace
37/// http://schemas.openxmlformats.org/spreadsheetml/2006/main.
38#[derive(Debug, Deserialize, Serialize, PartialEq)]
39pub struct XMLSheets {
40    #[serde(rename = "sheet")]
41    pub sheet: Vec<XMLSheet>,
42}
43
44/// XMLSheets defines a sheet in this workbook. Sheet data is stored in a
45/// separate part.
46#[derive(Debug, Deserialize, Serialize, PartialEq)]
47pub struct XMLSheet {
48    #[serde(rename = "name")]
49    pub name: String,
50    #[serde(rename = "sheetId")]
51    pub sheet_id: i32,
52    #[serde(rename = "r:id")]
53    pub id: String,
54}