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.
Microsoft.Office.Interop.Excel を使用してデータを Excel セルに書き込みます。セルには特定の初期高さがあり、「merge cell = true」と「wrap text = true」の両方を設定しています。
セルの内容が大きい場合、セルの高さは増加しません。次の両方を試しました。
_range.entrirerow.autofit() _range.columns.autofit()
これは私にとっては何も機能しません。解決策を提案してください。
_range.Rows.Autofit(); を試してください。
注意: COM オブジェクトは二重ピリオドで解放されません。アクセスできない一時変数が作成されました。
むしろ使用してください:
Range rows = _range.Rows; rows.Autfit(); if (rows != null) { Marshal.FinalReleaseComObject(rows); }