none
Empty rows, disfiguring the page layout. Empty row needs to be deleted. Pls help. RRS feed

  • Question

  • Hi,

     

    I have an requirement to do the following things with an excel thats exported from a SRS report, with C#.

    • Setting the Page Layout to Landscape - works fine.
    • Setting Fit to Pages width and height - works fine.
    • Deleting a particular row in every alternative sheet - I have problems doing it.

    I use Excel Interop, and I've tried to delete it using different ways. It still doesnt work out.

     

    Excel.Range r = (Excel.Range)wSheet.get_Range("A7", "A7");

     

    r.UseStandardHeight = true;

     

    r.EntireRow.Delete(Excel.XlDeleteShiftDirection.xlShiftUp);

     

    range.Delete(Excel.XlDeleteShiftDirection.xlShiftUp);

     

    Any of these codes doesnt have any effect.

     

    I just want to delete the row. Can anyone help me out.

     

    Thanks & Regards,

     

    Socratees

    Monday, December 3, 2007 11:19 PM

All replies

  • If I'm not mistaking, it sounds like you've got empty rows in the report while still in reportviewer, and you don't want them their because of issues with it when it gets to excel.

     

    Assuming this....what you can do is use an expression for the visibility of the Rows in question.    Each tablerow has visibility settings with the Hidden property.  By default the Hidden property is set to false...which makes these rows show up on the report...setting Hidden to true will make the row not show up.

     

    So, lets assume that you want these rows to show sometimes but not others....you could use an expression in the hidden property.  For example...

     

     

    IIF(Fields!Year.Value = 1999, false, true)

     

    So based on the boolean condition, you'll set the hidden property to true or false on the report prior to exporting it to excel.  

     

     

    And remember, with the Hidden Property of any control in the reportviewer   false will show it, true will hide it.  Hope this helps, if not maybe explain a bit more about why you have to do it in excel instead of the report. Or whatever I'm not getting. 

    Tuesday, December 4, 2007 5:28 PM
  •  

    No. My report looks good on the report viewer. However, when I export it to excel, I get a very large blank space on the top of the second sheet. (The report has a page break).

     

    While page 1 of the report is aligned to the top, the page 2 is not aligned in such a way.

     

     

    Tuesday, December 4, 2007 10:41 PM