Hi Team,
I am using version “37.3.30.1189” and facing some problem after saving the excel file.
Steps to reproduce:
- Created manually one excel file along with some image in first two 5 rows.
- From VB .Net code, loaded the excel file and wrote the data and saved.
After saving, observed the image was removed.
Code:
'load data from excel into DataTable
Dim filePath As String = “…\TemplateExcel.xls”
SpreadsheetInfo.SetLicense(“xxxx-xxxx-xxxx-xxxx”)
Dim ef As ExcelFile = ExcelFile.Load(filePath)
Dim ws As ExcelWorksheet = ef.Worksheets.FirstOrDefault()
Dim dto As CreateDataTableOptions = New CreateDataTableOptions()
Dim dt As DataTable = ws.CreateDataTable(dto)
Dim dict As Dictionary(Of String, String) = DictionaryForAllDisplayColumns(displayItems)
'Write data to excel
Dim increment As Integer = 0
For Each key As KeyValuePair(Of String, String) In dict
ws.Cells(5, increment).Value = key.Value
For j As Integer = 5 To workData.Rows.Count - 1
ws.Cells(j + 1, increment).Value = workData.Rows(j)(key.Key).ToString()
Next
increment += 1
Next
’ Save thee Excel file which is opened in ExcelFile object to a file
ef.Save(filePath)
Result before and after save:
Please provide the solution, how to persist the image.
Thanks,
Girish