ググっただけですが、以下の回答の中に
Add Columns to Existing Excel 2007 workbook using Open Xml
https://stackoverflow.com/questions/24038689/add-columns-to-existing-excel-2007-workbook-using-open-xml
"Inserting" a column like you mean is a very large and complex task with OpenXmlSDK.
From my understanding of the problem, it means you will have to find all cells and shift them by changing their reference (ex. a cell with ref "B1" would become "F1" after inserting 3 columns, etc ...). And it means you will have to change a lot of other things (reference of cell in formulas for example).
This kind of task could be easily done with Office.Interop or probably with libraries like EEPlus or ClosedXml.
とあり、適当に翻訳すると
あなたが言っているように列を "挿入"することは、OpenXmlSDKでは非常に大きく複雑な作業です。
私が問題を理解したことから、それはあなたがすべてのセルを見つけてそれらの参照を変えることによってそれらをシフトしなければならないことを意味します(例えば、参照 "B1"のセルは3列挿入後に "F1"になるでしょう、など)そしてそれはあなたが他の多くのことを変更しなければならないだろうことを意味します(例えば式のセルの参照)。
この種の作業は、Office.Interopを使って、あるいはおそらくEEPlusやClosedXmlのようなライブラリを使って簡単に行うことができます。
となります。
最悪のCOMとおっしゃっている方法が一番現実的なのかと予想されます。
もしくはEEPlus(EPPlusの間違い?)も試してみてはいかがでしょうか。
追記:
EPPlusも実験してみましたが、
sheet.InsertColumn(1, 1);
という感じでお手軽に列の挿入は可能でした。
しかし、図形は自動で動かないので、何らかの対策が必要かと思われます。
バッドをするには、ログインかつ
こちらの条件を満たす必要があります。
退会済みユーザー
2019/01/18 08:37