DropDownList width in Excel

Last post 10-10-2008 4:59 AM by Qin Dian Tang - MSFT. 5 replies.

Sort Posts:

  • DropDownList width in Excel

    09-23-2008, 10:24 PM
    • Member
      196 point Member
    • blackpuppy
    • Member since 04-29-2005, 5:42 AM
    • Posts 90

    I am exporting a GridView to Excel file (actually just html table fragment) from my ASP.NET page.  But in one column, there is a DropDownList that has very long item.  So the result .xls(html) file is like this:

    <table ...>
    ...
    <tr>
    ...
    <td style="width:1200px;">
    <select>
    ...
    <option value="long item">Extreme long item with 1xxx characters...till end of road</option>
    ...
    </select>
    </td>
    ...
    </tr>
    ...
    </table>
    And the result is the <select> control will appear very wide in Excel.  That's why I have to make the table cell wider (1200px) to contain the DropDownList.  Is there a way to control the width of the <select> control displayed in Excel (such as using some Office-specific tags)?

    Thanks!
    Thanks and best regards!
    blackpuppy
    ----------------------------------------------------
    The more you know, the more you know you don't know.
  • Re: DropDownList width in Excel

    09-23-2008, 11:55 PM
    • Contributor
      2,778 point Contributor
    • sivakl_2001
    • Member since 01-11-2008, 8:13 AM
    • Kuala Lumpur, Phileo Damansara
    • Posts 804

    yes u can do it try the following links

     How Do I Videos - Office
    http://msdn.microsoft.com/en-us/office/bb496949.aspx

    msdn
    http://msdn.microsoft.com/en-us/library/aa140990.aspx

  • Re: DropDownList width in Excel

    09-24-2008, 12:41 AM
    • Member
      196 point Member
    • blackpuppy
    • Member since 04-29-2005, 5:42 AM
    • Posts 90

    Thanks, sivakl_2001!  However, I cannot watch the video now because it's been blocked in the office.  I will watch it later.

    What is your solution?  Is it to use Excel Add-ins?  If that is the case, I am afraid it's not feasible because I cannot deploy the Add-in to the users' machine from a web application.

    Is it possible to just do something in the HTML we are downloading?

    Thanks!

    Thanks and best regards!
    blackpuppy
    ----------------------------------------------------
    The more you know, the more you know you don't know.
  • Re: DropDownList width in Excel

    09-26-2008, 5:20 AM
    Qin Dian Tang
    Microsoft Online Community Support

    Please remember to mark the replies as answers if they help and unmark them if they provide no help.
  • Re: DropDownList width in Excel

    10-10-2008, 4:43 AM
    • Member
      196 point Member
    • blackpuppy
    • Member since 04-29-2005, 5:42 AM
    • Posts 90

    Maybe these two are articles are good generic guidelines on how to export GridView to Excel.  But is it relevant with my specific question?  I cannot find anything in these articles mentioning the width of DropDownList in Excel.  Sorry I don't think they are answer to my question.

    Thanks and best regards!
    blackpuppy
    ----------------------------------------------------
    The more you know, the more you know you don't know.
  • Re: DropDownList width in Excel

    10-10-2008, 4:59 AM

    Hi blackpuppy,

    In this sample: http://www.dotnetspider.com/resources/20316-Export-GridView-Excel-File-using-Asp-net.aspx

    You can add a Label control instead of LiteralControl in sample, and set the width of Label. Then add the Label to control.

    Thanks,

    Qin Dian Tang
    Microsoft Online Community Support

    Please remember to mark the replies as answers if they help and unmark them if they provide no help.
Page 1 of 1 (6 items)