本文整理汇总了C#中Microsoft.SaveAs方法的典型用法代码示例。如果您正苦于以下问题:C# Microsoft.SaveAs方法的具体用法?C# Microsoft.SaveAs怎么用?C# Microsoft.SaveAs使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Microsoft
的用法示例。
在下文中一共展示了Microsoft.SaveAs方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: saveSlides
public static void saveSlides(Microsoft.Office.Interop.PowerPoint.Presentation presentation)
{
string desktopPath = Environment.GetFolderPath(Environment.SpecialFolder.Desktop);
//string path = Path.GetDirectoryName(System.Reflection.Assembly.GetExecutingAssembly().Location);
string filePath = desktopPath + "\\Slides.pptx";
// Microsoft.Office.Interop.PowerPoint.FileConverter fc = new Microsoft.Office.Interop.PowerPoint.FileConverter();
// if (fc.CanSave) { }
//https://msdn.microsoft.com/en-us/library/system.windows.forms.savefiledialog(v=vs.110).aspx
//Browse Files
Microsoft.Win32.SaveFileDialog dlg = new Microsoft.Win32.SaveFileDialog();
dlg.InitialDirectory = desktopPath+"\\Scano";
dlg.DefaultExt = ".pptx";
dlg.Filter = "PPTX Files (*.pptx)|*.pptx";
Nullable<bool> result = dlg.ShowDialog();
// Get the selected file name and display in a TextBox
if (result == true)
{
// Open document
filePath = dlg.FileName;
//textBox1.Text = filename;
}
else
{
System.Console.WriteLine("Couldn't show the dialog.");
}
presentation.SaveAs(filePath,
Microsoft.Office.Interop.PowerPoint.PpSaveAsFileType.ppSaveAsOpenXMLPresentation,
Microsoft.Office.Core.MsoTriState.msoTriStateMixed);
System.Console.WriteLine("PowerPoint application saved in {0}.", filePath);
}
示例2: SaveHtml
/// <summary>
/// 另存为html文件
/// </summary>
/// <param name="CurBook">Workbook</param>
/// <param name="strFilePath">文件路径</param>
public void SaveHtml(Microsoft.Office.Interop.Excel._Workbook CurBook, string strFilePath)
{
CurBook.SaveAs(strFilePath, Microsoft.Office.Interop.Excel.XlFileFormat.xlHtml, mValue, mValue, mValue, mValue, Microsoft.Office.Interop.Excel.XlSaveAsAccessMode.xlNoChange, mValue, mValue, mValue, mValue, mValue);
}
示例3: ProcessMailSynchronously
private bool ProcessMailSynchronously(bool bSendAndProtect, Microsoft.Office.Interop.Outlook.MailItem mailItem)
{
if (_lcfm == null)
_lcfm = new LocalCopyOfFileManager(true);
mailItem.SaveAs(_lcfm.GetLocalCopyOfFileTarget(Guid.NewGuid().ToString()));
Logger.LogInfo("[WORKSHARE PROTECT ASYNCH-MODE] - Processing mail synchronously.");
OutlookHookWorker outlookHookWorker = new OutlookHookWorker();
outlookHookWorker.SendAndProtect = bSendAndProtect;
outlookHookWorker.ProtectSimple = this.UsingProtectSimple;
outlookHookWorker.IsDeterministicSendEnabled = IsDeterministicSendEnabled();
outlookHookWorker.IsOutlookSecurityDisabled = DisableOutlookSecurity();
bool result = outlookHookWorker.NotifyOfItemSend(mailItem);
m_bIsProtectDisabledForCurrentRouting = outlookHookWorker.IsProtectDisabledForCurrentRouting;
m_bIsSendLink = outlookHookWorker.IsSendLink;
m_bFormattedMsgText = outlookHookWorker.FormattedMsgText;
CleanUpForInterwovenEMM();
if (outlookHookWorker.IsOutlookSecurityDisabled)
{
EnableOutlookSecurity();
}
return result;
}
示例4: SaveAs
/// <summary>
/// 保存文件
/// </summary>
/// <param name="CurBook">Workbook</param>
/// <param name="strFilePath">文件路径</param>
public void SaveAs(Microsoft.Office.Interop.Excel._Workbook CurBook, string strFilePath)
{
CurBook.SaveAs(strFilePath, mValue, mValue, mValue, mValue, mValue, Microsoft.Office.Interop.Excel.XlSaveAsAccessMode.xlShared, mValue, mValue, mValue, mValue, mValue);
}
示例5: CloseWorkBook
void CloseWorkBook(Microsoft.Office.Interop.Excel.Workbook ExcelWb, String TargetDirectory, String SaveName)
{
String ExcelFileName = Path.Combine(TargetDirectory, SaveName);
if (File.Exists(ExcelFileName))
File.Delete(ExcelFileName);
ExcelWb.SaveAs(ExcelFileName, Microsoft.Office.Interop.Excel.XlFileFormat.xlWorkbookDefault, Missing.Value,
Missing.Value, Missing.Value, Missing.Value, Microsoft.Office.Interop.Excel.XlSaveAsAccessMode.xlNoChange,
Missing.Value, Missing.Value, Missing.Value, Missing.Value, Missing.Value);
ExcelWb.Close(Missing.Value, Missing.Value, Missing.Value);
ExcelApplication.Quit();
ExcelWb = null;
ExcelApplication = null;
}
示例6: saveSlidesInBackground
public static void saveSlidesInBackground(Microsoft.Office.Interop.PowerPoint.Presentation presentation, String fileName)
{
String filePath = folderPath+fileName+".pptx";
presentation.SaveAs(filePath,
Microsoft.Office.Interop.PowerPoint.PpSaveAsFileType.ppSaveAsOpenXMLPresentation,
Microsoft.Office.Core.MsoTriState.msoTriStateMixed);
System.Console.WriteLine("PowerPoint application saved in {0}.", filePath);
}
示例7: exportToExcel_Saving
private void exportToExcel_Saving(object sender, Microsoft.Office.Interop.Excel.Workbook e)
{
LotCardExport exportToExcel = sender as LotCardExport;
//待保存工作簿的文件名
string fileName = exportToExcel.SaveFileName;
//实际文件物理路径
string sNewFullFile = HttpContext.Current.Server.MapPath(exportToExcel.SaveFileName);
//删除该目录下所有excel文件
foreach (var itm in (
new FileInfo(sNewFullFile)).Directory.GetFiles("*.xls", SearchOption.TopDirectoryOnly)
)
{
itm.Delete();
}
//检测指定文件是否存在
if (File.Exists(sNewFullFile))
{
//新文件名
exportToExcel.SaveFileName = exportToExcel.SaveFileName.Replace(".xls", Guid.NewGuid().ToString() + ".xls");
//新物理文件名
sNewFullFile = HttpContext.Current.Server.MapPath(exportToExcel.SaveFileName);
}
//保存到临时文件
e.SaveAs(sNewFullFile);
//虚拟路径
string urlPath = HttpContext.Current.Request.FilePath;
int index = urlPath.LastIndexOf('/');
if (index >= 0)
{
//获取除文件名件外的虚拟路径
urlPath = urlPath.Substring(0, index+1);
}
//文件保存位置的虚拟路径和名称
exportToExcel.SaveFileName = urlPath + exportToExcel.SaveFileName;
}
示例8: SaveDocument
private void SaveDocument(Microsoft.Office.Interop.Word.Document wordDocument, Microsoft.Office.Interop.Word.ApplicationClass wordApp, string filePath)
{
object Visible = false;
object missing = System.Reflection.Missing.Value;
Object Nothing = System.Reflection.Missing.Value;
object Save_FileName = filePath;
//保存模板文件
wordDocument.SaveAs(ref Save_FileName, ref missing, ref missing, ref missing, ref missing,
ref missing, ref missing, ref missing, ref Visible,
ref missing, ref missing, ref missing, ref missing, ref missing, ref missing,
ref missing);
//关闭wordDoc文档对象
wordDocument.Close(ref Nothing, ref Nothing, ref Nothing);
wordDocument = null;
//关闭wordApp组件对象
wordApp.Quit(ref Nothing, ref Nothing, ref Nothing);
}