|
|
|
@ -1,7 +1,7 @@
|
|
|
|
use std::path::Path;
|
|
|
|
use std::path::Path;
|
|
|
|
use umya_spreadsheet::{Range, Worksheet, reader};
|
|
|
|
use umya_spreadsheet::{Range, Worksheet, reader};
|
|
|
|
|
|
|
|
|
|
|
|
use crate::arguments::Arguments;
|
|
|
|
use crate::arguments::{Arguments, TrimSpaces};
|
|
|
|
use crate::error::Error;
|
|
|
|
use crate::error::Error;
|
|
|
|
|
|
|
|
|
|
|
|
pub fn xlsxtocsv(args: &Arguments) -> Result<(), Error> {
|
|
|
|
pub fn xlsxtocsv(args: &Arguments) -> Result<(), Error> {
|
|
|
|
@ -85,9 +85,12 @@ pub fn xlsxtocsv(args: &Arguments) -> Result<(), Error> {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// apply modifications to cells value (trim spaces, replace separator chars, line breaks etc.)
|
|
|
|
// apply modifications to cells value (trim spaces, replace separator chars, line breaks etc.)
|
|
|
|
if args.trim_end {
|
|
|
|
value = match args.trim {
|
|
|
|
value = String::from(value.trim_end());
|
|
|
|
TrimSpaces::End => String::from(value.trim_end()),
|
|
|
|
}
|
|
|
|
TrimSpaces::Start => String::from(value.trim_start()),
|
|
|
|
|
|
|
|
TrimSpaces::Both => String::from(value.trim()),
|
|
|
|
|
|
|
|
TrimSpaces::None => value,
|
|
|
|
|
|
|
|
};
|
|
|
|
value = value.replace('\r', "").replace('\n', " ");
|
|
|
|
value = value.replace('\r', "").replace('\n', " ");
|
|
|
|
if let Some(ref replacement) = args.replace_separator_by {
|
|
|
|
if let Some(ref replacement) = args.replace_separator_by {
|
|
|
|
value = value.replace(args.separator, replacement);
|
|
|
|
value = value.replace(args.separator, replacement);
|
|
|
|
|