locked
ASP .NET Grid export to Word 2010 is too wide RRS feed

  • Question

  • Hi,

     

    I have an ASP .NET application that produces search results in a grid control. When I export the data from the grid on the page, it initially appears too wide when in Word or Excel. Excel can easily be resized to fit the page for printing. Office 2007 can easily resize the table by going to View > Print Layout. However, the method that works in Word 2007 does not change anything in Word 2010. I simply cannot find a way for Word 2010 to resize the table to fit the page width in order for it to be printed.

    Any suggestions?

    Friday, August 19, 2011 12:49 PM

Answers

  • You could try this approach:

    Sub TableFit()
    Dim tbl As Table
      Set tbl = ActiveDocument.Tables(1)
      tbl.AutoFitBehavior wdAutoFitWindow
      Set tbl = Nothing
    End Sub
    



    • Marked as answer by Max Meng Wednesday, August 24, 2011 9:06 AM
    Friday, August 19, 2011 1:11 PM