如何使用打开的xml在运行时动态冻结sheetview中的窗格?

时间:2019-07-05 11:59:19

标签: c# .net openxml

我正在使用 Open XML sdk创建一个excel文档。创建它时,我必须传递行号 iFreezePaneRowNumber ),直到我希望窗格在图纸视图内保持冻结的位置。但是,就我而言,我没有行号的先验知识,仅当我开始在excel中写入数据时才计算行号。有什么方法可以更改 Pane 对象的 VerticalSplit 属性,还是有更好的方法?

oXMLWriter.WriteStartElement(new SheetViews());
oXMLWriter.WriteStartElement(new SheetView() { TabSelected = true, WorkbookViewId = (UInt32Value)0U });
oXMLWriter.WriteStartElement(new Pane() { ActivePane = PaneValues.BottomLeft, State = PaneStateValues.Frozen, TopLeftCell = sFreezeCell, VerticalSplit = iFreezePaneRowNumber });
oXMLWriter.WriteEndElement();
oXMLWriter.WriteStartElement(new Selection() { Pane = PaneValues.BottomLeft });
oXMLWriter.WriteEndElement();
oXMLWriter.WriteEndElement();
oXMLWriter.WriteEndElement();

0 个答案:

没有答案