如何使用python win32com编辑Excel分页符?

时间:2016-11-06 18:52:55

标签: python excel win32com

尝试使用python和win32com将页面打印到打印区域...
目前我只通过VBA宏找到了解决方案:

Sub PageBreak()  
    With ActiveSheet  
        If .VPageBreaks.Count > 0 Then  
            .VPageBreaks(1).DragOff xlToRight, 1  
        End If  
    End With  
End Sub

我可以不用宏吗?谢谢你的帮助。

1 个答案:

答案 0 :(得分:0)

实测值:

public void actionPerformed(ActionEvent e) {
  try {
    Query q = new Query(null);
    q.setVisible(true);//This opens the supposed second frame
    String query = query.getText();  // I'm doing the query on the main frame, this data should be acquired from the query frame
    Statement statement = conn.createStatement();
    ResultSet rs = statement.executeQuery(query);
    table.setModel(DbUtils.resultSetToTableModel(rs));