Answered Excel formatting

  • Wednesday, January 23, 2013 4:05 AM
     
     

    Hi,

    I have an excel file (.xls) and I want to format it( adding borders, setting columns width, etc), but I want to do this without Excel. By this I mean to not have Excel installed on the  machine in order to run the program.

    I tried this one:

    Excel Xml Writer Library.

    But when trying to open the xls files it gave an error, so I want to use another one.

    Which free technology can I use?

    Thanks.


    pyram



    • Edited by pyram07 Wednesday, January 23, 2013 4:43 AM
    •  

All Replies

  • Wednesday, January 23, 2013 5:44 AM
     
     Answered

    You can have a try at NPOI. Please refer to http://npoi.codeplex.com/


    mark kang

    • Marked As Answer by pyram07 Wednesday, January 23, 2013 3:02 PM
    •  
  • Wednesday, January 23, 2013 5:56 AM
     
     Answered

    try this

    http://www.carlosag.net/tools/excelxmlwriter/generator

    • Marked As Answer by pyram07 Wednesday, January 23, 2013 3:02 PM
    •  
  • Wednesday, January 23, 2013 1:16 PM
     
     Answered

    When you speak of "Excel Sheet" do you mean a .xls (pre-2007 format) or .xlsx (the new fomrat used since Excel 2007)?

    I ask because the later is nothing more then a bunch of XML files in a zip-container. (You can check that by renaming a *.xlsx to *.zip and view it's contents.)
    And modifying a few XML file(s) in a zip container is many times easier then doing work with the older Excel Sheet Formats.

    • Marked As Answer by pyram07 Wednesday, January 23, 2013 3:02 PM
    •  
  • Wednesday, January 23, 2013 3:02 PM
     
     
    Thank you all!

    pyram

  • Thursday, January 24, 2013 2:33 AM
     
     Answered Has Code

    Add Borders:

                //Load Excel
                Workbook workbook = new Workbook();
                workbook.LoadFromFile(@"..\..\test.xls");
                Worksheet sheet = workbook.Worksheets[0];
                 
                //Add Borders
                sheet.Range["A1:E15"].Borders.LineStyle = LineStyleType.Double;
                sheet.Range["A1:E15"].Borders[BordersLineType.DiagonalDown].LineStyle = LineStyleType.None;
                sheet.Range["A1:E15"].Borders[BordersLineType.DiagonalUp].LineStyle = LineStyleType.None;
                sheet.Range["A1:E15"].Borders.Color = Color.DeepSkyBlue;

    Setting Column Width:

                sheet.SetColumnWidth(3, 18);
    I use a .NET Excel component without MS Excel.

    • Marked As Answer by pyram07 Friday, January 25, 2013 6:10 PM
    •