locked
pivotfield autosort in c# RRS feed

  • Question

  •  

    After setting autosort to ascending or descending, the pivotitem.visible = true is generating the following error.

     

    "AutoSort must be turned off to move items in a field". I'm not sure why it's doing that, but reading other threads, it seems to be a bug?

     

    In VB, it was recommended to set the sort type to manual before setting the visible property. Then my question is, how do you set the autosort to manual in C#?

     

    I've tried setting the value to 0, and it was generating an interop error

    pf.autosort(1, pf.name.toString())  <== This sets the autosort to ascending.

    pf.autosort(2, pf.name.toString())  <== This sets the autosort to descending.

    pf.autosort(0, pf.name.toString())  <== interop error. "Exception from HRESULT: 0x800A03EC"

     

    Any workarounds?

     

    Thanks

     

    Tae-Suk

    Monday, June 9, 2008 2:14 AM

Answers

  • Hi,

     

    The xlManual is Excel.Constants.xlManual. Value is -4135.

    So try pf.AutoSort(-4135, pf.Name.ToString()) to see if it works.

     

     

    Thanks,

    Ji

    Wednesday, June 11, 2008 9:00 AM

All replies

  • Hi,

     

    The xlManual is Excel.Constants.xlManual. Value is -4135.

    So try pf.AutoSort(-4135, pf.Name.ToString()) to see if it works.

     

     

    Thanks,

    Ji

    Wednesday, June 11, 2008 9:00 AM
  • Thank you very much !

     

    Thursday, June 12, 2008 2:37 AM