将选项 "automatic return" 添加到我的单元格 C#

Add the option "automatic return" to my cells C#

我想将选项 "automatic return"(法语 "retour automatique à la ligne")添加到我的 Excel 文件中的所有活动单元格。 现在我已经尝试了很多东西,但我找不到这个选项...

你能帮帮我吗?这是我拥有的:

using Excel = Microsoft.Office.Interop.Excel;

Excel.Application app = new Excel.Application();
wb = app.Workbooks.Open(PathWrite.Replace(".csv", ".xlsx"), Type.Missing, 
Type.Missing, Type.Missing, Type.Missing, Type.Missing, Type.Missing, 
Type.Missing, Type.Missing, Type.Missing, Type.Missing, Type.Missing, 
Type.Missing, Type.Missing, Type.Missing);
Excel._Worksheet workSheet = app.ActiveSheet;
for (int x = 1; x <= 7; x++)
{
     Excel.Range range = workSheet.Columns[x];
     range.VerticalAlignment = Excel.XlVAlign.xlVAlignCenter;
     range.HorizontalAlignment = Excel.XlHAlign.xlHAlignCenter;

     workSheet.Columns.UseStandardWidth = 30;
     Excel.Borders border = range.Borders;
     border.LineStyle = Excel.XlLineStyle.xlContinuous;
     border.Weight = Excel.XlBorderWeight.xlThin;
     border.ColorIndex = Excel.XlColorIndex.xlColorIndexAutomatic;
     range.AutoFit();
}

对于简历,我想格式化我通过将 .csv 文件转换为 .xlsx 文件创建的文件。我不习惯 Office Interop,所以请不要犹豫告诉我是否有问题,出现这种令人厌恶的 for 循环的原因是我没有成功 select 只有前 7 列有一个命令。这只是我用 C# 编写 Excel 的第二天,所以请放纵一下。对于我的语言,我想,我的英语不是很好。

感谢阅读本文

我相信你想要的设置是自动换行:

range.WrapText = True