How to sort a particular page in gridview?

How can l control the Excel Export from a Gridview. I want to be able to control page size, font, orientation?

  • This "gridview" is a control in Visual Studio. I've already succeeded in creating the "Excel Export" from a gridview, but now when the user clicks the "Export" button, the worksheet already needs to be ready to print with no adjustments -- this is the part I can find no answer to.

  • Answer:

    I have created Macros before that basically re-formats whole workbooks (from 3 to 50 worksheets) for printing. It is easier to control from within the VBA code of MS-Excel. And it will allow one to make any changes they so desire, including popup dialog to ask the User for possible Headings, Sizes, Colors, and other issues that one might wish to make more flexible. I would paste an example of such, but it is about 300 lines of code, so I will put just a few specific lines here: Selection.SpecialCells( xlCellTypeLastCell ).Select Selection.Activate intRow1 = ActiveCell.Row + 2 intCtr2 = intCtr2 + 1 If intCtr2 = 3 Then Cells(intRow1, 1).Activate ActiveWindow. SelectedSheets. HPageBreaks. Add Before:=ActiveCell intCtr2 = 0 End If Sheets(1).Activate With ActiveSheet.PageSetup .PrintTitleRows = "" .PrintTitleColumns = "" .PrintArea = "" .LeftHeader = "" .CenterHeader = "&""Arial,Bold""&14" & strTitle1 & vbLf & _ "&""Arial,Regular""&10" & "&A -- " & strTitle2 & " Responses" .RightHeader = "" .LeftFooter = "&D -- &T" .CenterFooter = "" .RightFooter = "Page &P of &N" .HeaderMargin = Application.InchesToPoints(0.5) .TopMargin = Application.InchesToPoints(1) .LeftMargin = Application.InchesToPoints(0.5) .RightMargin = Application.InchesToPoints(0.5) .BottomMargin = Application.InchesToPoints(0.5) .FooterMargin = Application.InchesToPoints(0.25) .PrintHeadings = False .PrintGridlines = False .PrintComments = xlPrintNoComments ' .PrintQuality = 600 .CenterHorizontally = True .CenterVertically = True .Orientation = xlLandscape .Draft = False .PaperSize = xlPaperLetter .FirstPageNumber = xlAutomatic .Order = xlDownThenOver .BlackAndWhite = False .Zoom = 100 .PrintErrors = xlPrintErrorsDisplayed End With With ActiveWindow .View = xlPageBreakPreview .Zoom = 90 .SelectedSheets.PrintPreview End With

Athena at Yahoo! Answers Visit the source

Was this solution helpful to you?

Just Added Q & A:

Find solution

For every problem there is a solution! Proved by Solucija.

  • Got an issue and looking for advice?

  • Ask Solucija to search every corner of the Web for help.

  • Get workable solutions and helpful tips in a moment.

Just ask Solucija about an issue you face and immediately get a list of ready solutions, answers and tips from other Internet users. We always provide the most suitable and complete answer to your question at the top, along with a few good alternatives below.