Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Importer latest fixes #997

Merged
merged 9 commits into from
Apr 30, 2021
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ public ExcelReader(string path, bool columnOffsetOn = true)

_columnOffsetOn = columnOffsetOn;
_sheetEnumerator = _book.GetEnumerator();
_isTypeXlsx = Path.GetExtension(path).Equals(Constants.Filter.XLSX_EXTENSION);
_isTypeXlsx = Path.GetExtension(path.ToLower()).Equals(Constants.Filter.XLSX_EXTENSION);
_formulaEvaluator = _book.GetCreationHelper().CreateFormulaEvaluator();
}

Expand All @@ -49,7 +49,7 @@ public void LoadNewWorkbook(string path, bool columnOffsetOn = true)

_sheetEnumerator = _book.GetEnumerator();
_columnOffsetOn = columnOffsetOn;
_isTypeXlsx = Path.GetExtension(path).Equals(Constants.Filter.XLSX_EXTENSION);
_isTypeXlsx = Path.GetExtension(path.ToLower()).Equals(Constants.Filter.XLSX_EXTENSION);
}

public bool MoveToNextSheet()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,11 @@ public void SetDataSource(string dataSourceFileName)
{
if (string.IsNullOrEmpty(dataSourceFileName)) return;

SetSourceFile(dataSourceFileName);
if (!SetSourceFile(dataSourceFileName))
{
_dialogCreator.MessageBoxError(Captions.Importer.FileFormatNotSupported(dataSourceFileName));
return;
}
_view.DisableConfirmationView();
}

Expand Down Expand Up @@ -279,12 +283,12 @@ private void onCompletedMapping(object sender, EventArgs args)

public bool SetSourceFile(string path)
{
_sourceFilePresenter.SetFilePath(path);
_dataSourceFile = _importerDataPresenter.SetDataSource(path);

if (_dataSourceFile == null)
return false;

_sourceFilePresenter.SetFilePath(path);
_columnMappingPresenter.ValidateMapping();
_configuration.FileName = path;

Expand Down