Skip to content

Commit

Permalink
Fixed salarcode#17
Browse files Browse the repository at this point in the history
Excel Import : Linked field can't translate. Changed linked datasource and fixed default KeyColumn selection
  • Loading branch information
WebSpiderTeam committed Jul 31, 2023
1 parent b7b3a1f commit 6f4e453
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 8 deletions.
10 changes: 6 additions & 4 deletions AutoResxTranslator/ResxExcel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,9 @@ public class ResxExcel
public class ExcelFileInfo
{
public string[] SheetNames { get; set; }
public string[] SheetColumns { get; set; }
}
public string[] SheetColumnsKey { get; set; }
public string[] SheetColumnsTranslation { get; set; }
}

public static ExcelFileInfo ReadExcel(string excelFile)
{
Expand Down Expand Up @@ -68,8 +69,9 @@ public static ExcelFileInfo ReadExcel(string excelFile)
columns.Add(column.ColumnName);
}
}
result.SheetColumns = columns.ToArray();
}
result.SheetColumnsKey = columns.ToArray();
result.SheetColumnsTranslation = columns.ToArray();
}
}

return result;
Expand Down
8 changes: 4 additions & 4 deletions AutoResxTranslator/frmMain.cs
Original file line number Diff line number Diff line change
Expand Up @@ -706,11 +706,11 @@ private void btnOpenExcel_Click(object sender, EventArgs e)
return;
}
cmbExcelSheets.DataSource = excel.SheetNames;
cmbExcelKey.DataSource = excel.SheetColumns;
cmbExcelTranslation.DataSource = excel.SheetColumns;
if (Array.IndexOf(excel.SheetColumns, "Name") != -1)
cmbExcelKey.DataSource = excel.SheetColumnsKey;
cmbExcelTranslation.DataSource = excel.SheetColumnsTranslation;
if (Array.IndexOf(excel.SheetColumnsKey, "Name") != -1)
{
cmbExcelKey.SelectedValue = "Name";
cmbExcelKey.SelectedIndex = Array.IndexOf(excel.SheetColumnsKey, "Name");
}
btnImportExcel.Enabled = true;
}
Expand Down

0 comments on commit 6f4e453

Please sign in to comment.