Home > Net >  The c # operation Excel
The c # operation Excel

Time:02-21

https://bbs.csdn.net/topics/395576484

Have asked last year, was tried, found that can realize functions, shelved,
This year there is a place to need, come back, found several problems,

First: the Visible here is false, but will jump out of a excel window, but also not completely, the following figure

ExcelHandle=new Microsoft. Office. Interop. Excel. Application
{
The Visible=false,//Excel application is Visible, it is said the Excel application is Visible, is that you can see,
//if set to false, the silence is equivalent to the background, the task bar will not show, but the process inside can be seen,

WindowState=XlWindowState xlMaximized,//Excel window popup state, only in the Visible=true to be meaningful,

DisplayAlerts=false//, such as our normal operation excel, as long as the modified content but no manual save again, at the time of closing application will prompt you to save the changes?" ,
//if this is set to false, it's not suggest this, for the background operation of the excel, suggest set to flase,
};

But if I put the visible false to true, is also a excel window, out of more than a little bit of the menu bar,

I just want to realize the background silent operation, but looks a bit wrong, and where you need to set up?

In addition, excel document preservation problems
ExcelHandle. ActiveWorkbook. The Save (); Invalid, can not save the file modification,
ExcelWorkBook. The Save (); Invalid, can not save the file to modify
ExcelHandle. ActiveWorkbook. Close (true, ExcelFilePath, false); Effectively, can put the original file modification,
Here is likely the first parameter to the save change, the second is the path, what's the third false parameters?

CodePudding user response:

Use the class library Aspose. Cells, the function is very powerful, computers do not need to install office
  •  Tags:  
  • C#
  • Related