Skip to content

Commit a3f1ea1

Browse files
committed
Merge branch '4.60-bug-fixes' into develop
2 parents 46ba998 + 9377ca8 commit a3f1ea1

File tree

1 file changed

+4
-9
lines changed

1 file changed

+4
-9
lines changed

src/Libraries/Nop.Services/ExportImport/ImportManager.cs

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -226,28 +226,23 @@ protected virtual async Task SetOutLineForSpecificationAttributeRowAsync(object
226226

227227
protected virtual void CopyDataToNewFile(ImportProductMetadata metadata, IXLWorksheet worksheet, string filePath, int startRow, int endRow, int endCell)
228228
{
229-
using var stream = new FileStream(filePath, FileMode.OpenOrCreate);
230-
// ok, we can run the real code of the sample now
231-
using var workbook = new XLWorkbook(stream);
232-
// uncomment this line if you want the XML written out to the outputDir
233-
//xlPackage.DebugMode = true;
229+
using var workbook = new XLWorkbook();
234230

235231
// get handles to the worksheets
236-
var outWorksheet = workbook.Worksheets.Add(typeof(Product).Name);
232+
var outWorksheet = workbook.Worksheets.Add(nameof(Product));
237233
metadata.Manager.WriteDefaultCaption(outWorksheet);
238234
var outRow = 2;
239235
for (var row = startRow; row <= endRow; row++)
240236
{
241237
outWorksheet.Row(outRow).OutlineLevel = worksheet.Row(row).OutlineLevel;
238+
242239
for (var cell = 1; cell <= endCell; cell++)
243-
{
244240
outWorksheet.Row(outRow).Cell(cell).Value = worksheet.Row(row).Cell(cell).Value;
245-
}
246241

247242
outRow += 1;
248243
}
249244

250-
workbook.Save();
245+
workbook.SaveAs(filePath);
251246
}
252247

253248
protected virtual int GetColumnIndex(string[] properties, string columnName)

0 commit comments

Comments
 (0)