Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>Well, then there is a short format verison:</p> <pre><code>using Microsoft.Office.Interop.Excel; // init excel Application excelApplication = new Application(); // ... // open book in any format Workbook workbook = excelApplication.Workbooks.Open("1.xls", XlUpdateLinks.xlUpdateLinksNever, true, Type.Missing, Type.Missing, Type.Missing, Type.Missing, Type.Missing, Type.Missing, Type.Missing, Type.Missing, Type.Missing, Type.Missing, Type.Missing, Type.Missing); // save in XlFileFormat.xlExcel12 format which is XLSB workbook.SaveAs("1.xlsb", XlFileFormat.xlExcel12, Type.Missing, Type.Missing, Type.Missing, Type.Missing, XlSaveAsAccessMode.xlExclusive, Type.Missing, Type.Missing, Type.Missing, Type.Missing, Type.Missing); // close workbook workbook.Close(false, Type.Missing, Type.Missing); // ... // shutdown excel excelApplication.Quit(); </code></pre> <p>You will need a Excel installation with .NET programming support (disabled by default in installer!) and reference MS Office PIA assembly for Excel from your project:</p> <p><img src="https://i.stack.imgur.com/DRdPS.png" alt="add Excel PIA reference"></p> <p>References: <a href="http://msdn.microsoft.com/en-us/library/microsoft.office.interop.excel.workbooks.open%28v=Office.11%29.aspx" rel="noreferrer">Workbooks.Open</a>, <a href="http://msdn.microsoft.com/en-us/library/microsoft.office.tools.excel.workbook.saveas%28v=VS.80%29.aspx" rel="noreferrer">workbook.SaveAs</a>, <a href="http://msdn.microsoft.com/en-us/library/microsoft.office.interop.excel.xlfileformat.aspx" rel="noreferrer">XlFileFormat.xlExcel12</a></p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload