Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
how can use C# write data into excel with password?
I can write data into excel without password:
objBook = objBooks.Add("D:\\1.xls"); objSheets = objBook.Worksheets; objSheet = (Excel._Worksheet)objSheets.get_Item(1); //Get the range where the starting cell has the address //m_sStartingCell and its dimensions are m_iNumRows x m_iNumCols. range = objSheet.get_Range("G1", Missing.Value); range = range.get_Resize(1,1); if (this.FillWithStrings.Checked == false) { //Create an array. double[,] saRet = new double[1,1]; //Fill the array.for (long iRow = 0; iRow < 1; iRow++) { { for (long iCol = 0; iCol < 1; iCol++)//Put a counter in the cell. saRet[iRow, iCol] = iRow * iCol; } } //Set the range value to the array. range.set_Value(Missing.Value, saRet ); } objApp.Visible = false; objApp.UserControl = true; // Save the workbook and quit Excel. objBook.SaveAs("D:\\1.xls", m_objOpt, m_objOpt, m_objOpt, m_objOpt, m_objOpt, Excel.XlSaveAsAccessMode.xlNoChange, m_objOpt, m_objOpt, m_objOpt, m_objOpt, m_objOpt); objBook.Close(false, m_objOpt, m_objOpt); objApp.Quit(); but if the excel have password,I cant do. thanks! |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Write Macro to Fix Data Alignment (Data dump from Crystal to Excel | Excel Discussion (Misc queries) | |||
Excel 2002: How to write protect a cell using password ? | Excel Discussion (Misc queries) | |||
How do you write an excel formula to sum data in every second cell | Excel Worksheet Functions | |||
is it possible to execute write to the fields in another .xsl form a macro in another .xsl? e.g. some way to load another .xsl into an .xsl macro and write to its data? | Excel Worksheet Functions | |||
Write Data to Excel Database | Excel Programming |