Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
using Microsoft.Office.Interop.Excel; Range rng = worksheet.UsedRange;
//以下のコードを見つけましたが、ExcelAlignemtとExcelの両方への参照が見つかりませんでしたこれに必要な参照が不足しています
rng.VerticalAlignment = ExcelAlignment.xlButtom; //or Excel.XlHAlign.xlHAlignLeft
xlHAlignCenterはExcel名前空間にあります:
worksheet.get_Range("A1", "A1").Style.HorizontalAlignment = Microsoft.Office.Interop.Excel.XlHAlign.xlHAlignCenter;
今、あなたのコードで:
rng.Style.VerticalAlignment = Microsoft.Office.Interop.Excel.XlHAlign.xlHAlignLeft;