///<Summary> /// ConvertProjectToPrimavera method to convert project to Primavera format ///</Summary> public Response ConvertProjectToPrimavera(string fileName, string folderName, string outputType) { if (outputType.Equals("xml") || outputType.Equals("xer") || outputType.Equals("txt") || outputType.Equals("xlsx")) { SaveFileFormat format = SaveFileFormat.TXT; if (outputType.Equals("xlsx")) { format = SaveFileFormat.XLSX; } else if (outputType.Equals("xml")) { format = SaveFileFormat.PrimaveraP6XML; } else if (outputType.Equals("xer")) { format = SaveFileFormat.PrimaveraXER; } return(ProcessTask(fileName, folderName, "." + outputType, false, false, delegate(string inFilePath, string outPath, string zipOutFolder) { Project project = new Project(inFilePath); project.Save(outPath, format); })); } return(new Response { FileName = null, Status = "Output type not found", StatusCode = 500 }); }
public void SaveSheetsIntoDiffTxtFiles(SaveFileFormat FileFormat) { var excel = new Application(); var workBook = excel.Application.Workbooks.Open(ExcelFilePath); excel.Visible = false; excel.DisplayAlerts = false; var workBookName = workBook.Name; //workBook.SaveAs(ExportFilesSavePath + "\\" + "4", XlFileFormat.,Type.Missing,Type.Missing,Type.Missing,Type.Missing,XlSaveAsAccessMode.xlExclusive,Type.Missing,Type.Missing,Type.Missing,XlTextVisualLayoutType.xlTextVisualLTR,Type.Missing); var workSheets = workBook.Sheets; foreach(Microsoft.Office.Interop.Excel.Worksheet workSheet in workSheets) { workSheet.SaveAs(ExportFilesSavePath + "\\" + workBookName + "_" + workSheet.Name + "."+FileFormat.ToString().ToLower(), XlFileFormat.xlTextPrinter); } workBook.Save(); excel.Quit(); }