Columns into generated ListObject's column

Hi,

I am in between with a serious problem. Actually I have to generate columns depending upon some types. 

i.e. I want  to generate columns into column, Lets see the structure:

Suppose I have three columns generated in Listobject as "Col1", "Col2" and "Col3". Now "Col1" also has some more columns into it as "Col1a", "Col1b", "Col1c" etc and I need to show them into excelsheet.

Is it possible in VSTO

Please assist me here.

Thank you



Answer this question

Columns into generated ListObject's column

  • Benji_bunni

    Hi Maarten,

    Thanks for your response. But there is no relation between it & the previous post: http://forums.microsoft.com/MSDN/ShowPost.aspx PostID=342314&SiteID=1. These are asking for different question.

    In the previous post, I was asking for how to put manual column into databound listobject. but here I want to dynamically generate columns into column from the varying data value into column.

    Thank you


  • Kevin Tang

    Hi Mohit,

    I am not able to follow you i.e. not getting what actually you want to say. If possible please provide some working code.

    Totally Confused:

    Question: Can we sub devide the column of listobject/excelsheet into 2 or more at the run time

    Here I have again shown the column layout from the table (following):

    Note: All three rows shown into following layout are the complete column of listobject. Please dont get confused that 3rd row is value not column.

    As shown into above table, there are 3 types of Transaction_Type: Cash, Finance and Lease. And automatic column generation will depend on these three type as described below:

     

     

     

     

      

     

    2000 km

    1500 km

    2000 km

    1500 km

     

    Cash

    Cash

    Finance Cash Rebate

    Finance Dealer Rebate

    Finance

    Lease Cash Rebate

    Lease Dealer Rebate

    Lease

    Dealer Rebate

    Cash Rebate

    Expiry

    12

    24

    36

    12

    24

    36

    Expiry

    36

    48

    36

    48

    36

    48

    38

     

     

     

    Every column as shown in above layout should be generated for each type of Transaction.

    1. Cash: If type is cash then data will get filled into first 2 column i.e. Cash wich has two sub column (Dealer Rebate, Cash Rebate) and Cash Expiry. Other column will be blank.

    2. Finance: If type is Finance then data will get filled into next 3 column i.e. into Finance Dealer Rebate, Finance Cash Rebate (both column have 3-3 sub columns (12, 24 etc) and Cash Expiry. Other column will be blank.

    3.Lease: If type is Lease then data will get filled into remaining columns.

    For "Cash" type, Cash column should have two sub columns (Dealer Rebate, Cash Rebate) i.e. 2 rows needed for column.

    For "Finance" type, each column should have more than two sub columns (12, 24, 36 etc) i.e. 2 rows needed for column.

    For "Lease" type, each column should have more than two sub columns (2000Km, 1500Km etc again columns being sub classed into more i.e. into 36, 48 etc) i.e. 3 rows needed for column.

    My Problem:

    How to achieve the above column layout into excelsheet/listobject i.e. How can we sub devide the column into more at the run time as shown into above layout.

    I am looking foe this problem for last 10 days but still not have the problem. Please assist me for the possible solutons.

    Thank you.


  • Chriz Lee

    Prashant,

    The simplest way for you to do this is to add calculated columns to your DataTable. Add a new DataColumn to the DataTable, and set it's Expression property to the calculation that will give you the result. See details of the Expression property of DataColumn at http://msdn.microsoft.com/library/default.asp url=/library/en-us/cpref/html/frlrfsystemdatadatacolumnclassexpressiontopic.asp

    Hope this helps.



  • Jeromelab

    Are you trying to set up a master-details relationship here

  • Esprit

    Hi,

    Is my requirement is not possible with VSTO

    There is not any option present

    Please assist me.

    Thank you


  • DJS -Damien

    Hi,

    < xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" /> 

    Following is the format of my tables from which I want to generate columns from columns.

     

    Transaction_Type:

     

    Tran_type_id

    Tran_type_name

    1

    2

    3

    Cash

    Finance

    Lease

      

    Bank_Transaction:

     

    Trans_id

    Tran_type_id

    Tran_rate (%)

    Tran_time (month)

    Distance (Km)

    Balance

    (Rs)

    Expiry

    Delear Rebate

    Cash Rebate

    Amount

    (Rs)

    1

    2

    3

    4

    5

    6

     

    1 (Cash)

    2 (Finance)

    2 (Finance)

    2 (Finance)

    3 (Lease)

    3 (Lease)

     

    -

    10

    12

    15

    5

    6

     

    -

    12

    24

    36

    36

    48

    -

    -

    -

    -

    2000

    1500

     

    200.00

    50.00

    60.00

    100.00

    100.00

    10.00

     

    -

    -

    -

    -

    -

    -

     

     

     

    200.00

    100.00

    50.00

    60.00

    20.00

    20.00

     

     

    Now requirement is that: there should be each column present in a row depending upon the transaction type.

    As you can see: Here columns for all type of the truncation present. But column generation on the following basis is very tough for me.

     

     

     

     

     

      

     

    2000 km

    1500 km

    2000 km

    1500 km

     

    Cash

    Cash

    Finance Cash Rebate

    Finance Dealer Rebate

    Finance

    Lease Cash Rebate

    Lease Dealer Rebate

    Lease

    Dealer Rebate

    Cash Rebate

    Expiry

    12

    24

    36

    12

    24

    36

    Expiry

    36

    48

    36

    48

    36

    48

    38

     

     

     Expiry

     

    There are some sub columns (12, 24, 36...) just below for each Finance & Lease column that should be generated dynamically from “tran_time” col value depending upon trans_type. This column may vary into their size.

     

    There are one more column type (highlited with pink color) i.e. 1500Km, 2000Km, etc that should be generated dynamically from the “distance” col value

     

    I want to achieve this through my database structure and VSTO dynamically. How is this possible

    A simple hint would also be grace for me.

    Thank you


  • Golobulous


    I believe your question was already answered more or less in one of your previous posts:
    http://forums.microsoft.com/MSDN/ShowPost.aspx PostID=342314&SiteID=1

    I understand that it is not complete to your satisfaction, but for now VSTO 'v2' is limited in some areas where you want to dynamically create/delete host-items/controls.

    Sometimes you are able to create/delete them dynamically but changes are not persisted when you save your document.

    Here you can read some extra information:
    http://msdn2.microsoft.com/en-us/library/ms178779(VS.80).aspx

    -= Maarten =-



  • Columns into generated ListObject's column