Tech Off Thread

11 posts

Forum Read Only

This forum has been made read only by the site admins. No new threads or comments can be added.

Converting XLS (XML) to XLS (Binary)

Back to Forum: Tech Off
  • User profile image
    sappyvcv

    I wrote a C# program to pull data from a remote database into a DataSet, then use XLST to transform that data into an Excel XML spreadsheet document.  This works fine and the file always loads perfectly for me.

    However, when I send the file to someone else with Office 2003 w/SP1 (same version I have), it doesn't load.  The error given is basically "Data too large for cell", as it seems to try and load ALL the cells into one cell.

    If I load the file up in Excel and resave as a binary XLS file, it works fine for him.

    However, this is all supposed to be automated, so I need to figure out why it won't load for him (not looking good) or how to convert the XML file to Binary XLS.  I originally tried to do straight to Binary, but didn't find a good solution.

    Any ideas?

    p.s. I tried writing from Opera, but it removes all the line breaks no matter what I do, thus creating one big ugly paragraph.

  • User profile image
    Harlequin

    Office Web Components.

    Then you can just change your Xml to SpreadsheetML, then save the Excel.

    http://msdn.microsoft.com/library/default.asp?url=/library/en-us/owcvba11/html/ocobjSpreadsheet.asp

    You can get lots by searching for "OWC11".

  • User profile image
    Maurits

    Hmmm... have you considered .csv format instead of XML?

  • User profile image
    Harlequin

    CSV wouldn't save the cell formatting if there is any though, that would be the downfall.

  • User profile image
    harumscarum

    Harlequin wrote:

    Office Web Components.

    Then you can just change your Xml to SpreadsheetML, then save the Excel.

    http://msdn.microsoft.com/library/default.asp?url=/library/en-us/owcvba11/html/ocobjSpreadsheet.asp

    You can get lots by searching for "OWC11".



    most underappreciated component from ms.

  • User profile image
    sappyvcv

    Harlequin wrote:

    Office Web Components.

    Then you can just change your Xml to SpreadsheetML, then save the Excel.

    http://msdn.microsoft.com/library/default.asp?url=/library/en-us/owcvba11/html/ocobjSpreadsheet.asp

    You can get lots by searching for "OWC11".


    I'm a little lost on how that works, could you expand on that please?

  • User profile image
    Harlequin

    If I remember right, you install Office Web Components on the server. You then drop/reference OWC11.dll(that name might be wrong).

    Then you can start using the SpreadSheet object.

    SpreadSheet MySpreadSheet = new SpreadSheet();

    Something like that. What you would then do is give it SpreadsheetML and then you can save it to the disk.

    Been a while, but I think that's pretty much what you need.

  • User profile image
    sappyvcv

    Harlequin wrote:
    If I remember right, you install Office Web Components on the server. You then drop/reference OWC11.dll(that name might be wrong).

    Then you can start using the SpreadSheet object.

    SpreadSheet MySpreadSheet = new SpreadSheet();

    Something like that. What you would then do is give it SpreadsheetML and then you can save it to the disk.

    Been a while, but I think that's pretty much what you need.

    The server?  If you mean the server the database is on, I only have access to the database.  I suppose I could convince them to install that, but who knows.

    If you mean web server -- there is none.  This is a local application, not a web application.

  • User profile image
    Harlequin

    Ahhh Winforms. I do believe it still works with WinForms, but I think then the users machine needs to have the Office Web Components installed.

  • User profile image
    sappyvcv

    Harlequin wrote:
    Ahhh Winforms. I do believe it still works with WinForms, but I think then the users machine needs to have the Office Web Components installed.
    Thanks for the help. For now, I'm just generating to CSV ( bleh Sad ) while I play around some more. I just wish I could figure out why the spreadsheet I produce that is in XML doesn't load for me and another person, but not for someone else.

  • User profile image
    Maurits

    sappyvcv wrote:
    For now, I'm just generating to CSV


    Lowest common denominator rules! Smiley

Conversation locked

This conversation has been locked by the site admins. No new comments can be made.