diff --git a/src/structs/cell.rs b/src/structs/cell.rs index fafea9b8..9e9fb5e5 100644 --- a/src/structs/cell.rs +++ b/src/structs/cell.rs @@ -26,19 +26,14 @@ pub struct Cell { hyperlink: Option, } impl Cell { - pub fn get_cell_value(&self) -> &CellValue { + pub(crate) fn get_cell_value(&self) -> &CellValue { &self.cell_value } - pub fn get_cell_value_mut(&mut self) -> &mut CellValue { + pub(crate) fn get_cell_value_mut(&mut self) -> &mut CellValue { &mut self.cell_value } - pub fn set_cell_value(&mut self, value: CellValue) -> &mut Self { - self.cell_value = value; - self - } - pub fn get_style(&self) -> &Style { &self.style } diff --git a/src/structs/cell_value.rs b/src/structs/cell_value.rs index 629478c4..87456e83 100644 --- a/src/structs/cell_value.rs +++ b/src/structs/cell_value.rs @@ -6,7 +6,7 @@ use std::borrow::Cow; use structs::CellRawValue; #[derive(Clone, Default, Debug, PartialEq, PartialOrd)] -pub struct CellValue { +pub(crate) struct CellValue { pub(crate) raw_value: CellRawValue, pub(crate) formula: Option, pub(crate) formula_attributes: Vec<(String, String)>, diff --git a/src/structs/spreadsheet.rs b/src/structs/spreadsheet.rs index c059b566..2383482a 100644 --- a/src/structs/spreadsheet.rs +++ b/src/structs/spreadsheet.rs @@ -177,23 +177,6 @@ impl Spreadsheet { } } - /// Gets the cell value by specifying an address. - /// # Arguments - /// * `address` - address. ex) "Sheet1!A1:C5" - /// # Return value - /// *`Vec<&CellValue>` - CellValue List. - /// # Examples - /// ``` - /// let mut book = umya_spreadsheet::new_file(); - /// let mut cell_value_List = book.get_cell_value_by_address("Sheet1!A1:C5"); - /// ``` - pub fn get_cell_value_by_address(&self, address: &str) -> Vec<&CellValue> { - let (sheet_name, range) = split_address(address); - self.get_sheet_by_name(&sheet_name) - .unwrap() - .get_cell_value_by_range(&range) - } - /// (This method is crate only.) /// Gets the cell value by specifying an Address Object. /// # Arguments diff --git a/src/structs/worksheet.rs b/src/structs/worksheet.rs index d490073c..62f3401a 100644 --- a/src/structs/worksheet.rs +++ b/src/structs/worksheet.rs @@ -315,84 +315,6 @@ impl Worksheet { self } - /// Get cell value. - /// # Arguments - /// * `coordinate` - Specify the coordinates. ex) `"A1"` or `(1, 1)` - /// # Return value - /// * `&CellValue` - CellValue. - /// # Examples - /// ``` - /// let book = umya_spreadsheet::new_file(); - /// let worksheet = book.get_sheet(&0).unwrap(); - /// let cell_value = worksheet.get_cell_value("A1"); - /// // or pass in a tuple `(col, row)`, both col and row starting at `1` - /// let cell_value = worksheet.get_cell_value((1, 1)); - /// ``` - pub fn get_cell_value(&self, coordinate: T) -> &CellValue - where - T: Into, - { - let CellCoordinates { col, row } = coordinate.into(); - self.cell_collection.get_cell_value(&col, &row) - } - - /// Gets the cell value by specifying the column number and row number. - /// # Arguments - /// * `col` - Specify the column number. (first column number is 1) - /// * `row` - Specify the row number. (first row number is 1) - /// # Return value - /// * `&CellValue` - CellValue. - /// # Examples - /// ``` - /// let book = umya_spreadsheet::new_file(); - /// let worksheet = book.get_sheet(&0).unwrap(); - /// let cell_value = worksheet.get_style_by_column_and_row(&1, &1); // get cell from A1. - /// ``` - #[deprecated(note = "use `get_cell_value` instead")] - pub fn get_cell_value_by_column_and_row(&self, col: &u32, row: &u32) -> &CellValue { - self.cell_collection.get_cell_value(col, row) - } - - /// Get cell value with mutable. - /// # Arguments - /// * `coordinate` - Specify the coordinates. ex) `"A1"` or `(1, 1)` - /// # Return value - /// * `&mut CellValue` - CellValue with mutable. - /// # Examples - /// ``` - /// let mut book = umya_spreadsheet::new_file(); - /// let mut worksheet = book.get_sheet_mut(&0).unwrap(); - /// let cell_value = worksheet.get_cell_value_mut("A1"); - /// // or pass in a tuple `(col, row)`, both col and row starting at `1` - /// let cell_value = worksheet.get_cell_value_mut((1, 1)); - /// ``` - pub fn get_cell_value_mut(&mut self, coordinate: T) -> &mut CellValue - where - T: Into, - { - let CellCoordinates { col, row } = coordinate.into(); - self.get_row_dimension_mut(&row); - self.cell_collection.get_mut(&col, &row).get_cell_value_mut() - } - - /// Gets the cell value with mutable by specifying the column number and row number. - /// # Arguments - /// * `col` - Specify the column number. (first column number is 1) - /// * `row` - Specify the row number. (first row number is 1) - /// # Return value - /// *`&mut CellValue` - CellValue with mutable. - /// # Examples - /// ``` - /// let mut book = umya_spreadsheet::new_file(); - /// let mut worksheet = book.get_sheet_mut(&0).unwrap(); - /// let cell_value = worksheet.get_cell_value_by_column_and_row_mut(&1, &1); // get cell_value from A1. - /// ``` - #[deprecated(note = "use `get_cell_value_mut` instead")] - pub fn get_cell_value_by_column_and_row_mut(&mut self, col: &u32, row: &u32) -> &mut CellValue { - self.get_row_dimension_mut(&row); - self.cell_collection.get_mut(col, row).get_cell_value_mut() - } - /// Gets the cell value by specifying an range. /// # Arguments /// * `range` - range. ex) "A1:C5" @@ -404,7 +326,7 @@ impl Worksheet { /// let mut worksheet = book.get_sheet_mut(&0).unwrap(); /// let mut cell_value_List = worksheet.get_cell_value_by_range("A1:C5"); /// ``` - pub fn get_cell_value_by_range(&self, range: &str) -> Vec<&CellValue> { + pub(crate) fn get_cell_value_by_range(&self, range: &str) -> Vec<&CellValue> { self.cell_collection.get_cell_value_by_range(range) }