public virtual ActionResult ExportTo(int id) { List<Electronics> list = Electronics.GetData(); ExportList<Electronics> exp = new ExportList<Electronics>(); exp.PathTemplateFolder = Server.MapPath("~/ExportTemplates/electronics"); string filePathExport = Server.MapPath("~/exports/a" + ExportBase.GetFileExtension((ExportToFormat)id)); exp.ExportTo(list, (ExportToFormat)id, filePathExport); return this.File(filePathExport, "application/octet-stream", System.IO.Path.GetFileName(filePathExport)); }
public void ToNoExportCall(object sender) { SetExportEventArgs eventArgs = new SetExportEventArgs() { ExportItemList = SelectedExportList, doExport = false }; SetExportEventHandler?.Invoke(this, eventArgs); foreach (ExportItem item in SelectedExportList) { NoExportList.Add(item); ExportList.Remove(item); item.IsSelected = false; } SelectedExportList.Clear(); }
static void Main(string[] args) { List<Electronics> list = Electronics.GetData(); ExportList<Electronics> exp = new ExportList<Electronics>(); exp.PathTemplateFolder = Path.Combine(Environment.CurrentDirectory, "templates/electronics"); exp.ExportTo(list, ExportToFormat.HTML, "a.html"); exp.ExportTo(list, ExportToFormat.CSV, "a.csv"); exp.ExportTo(list, ExportToFormat.XML, "a.xml"); exp.ExportTo(list, ExportToFormat.Word2003XML, "a_2003.doc"); exp.ExportTo(list, ExportToFormat.Excel2003XML, "a_2003.xls"); exp.ExportTo(list, ExportToFormat.Excel2007, "a.xlsx"); exp.ExportTo(list, ExportToFormat.Word2007, "a.docx"); exp.ExportTo(list, ExportToFormat.itextSharpXML, "a.xml"); exp.ExportTo(list, ExportToFormat.PDFtextSharpXML, "a.pdf"); }
public Mian() : base(AnimationType.Center, "wwwroot/Pages/Main2.html", false) { InitializeComponent(); base.ContextMenuHandler.OnBeforeContextMenu += (sender, e_) => e_.Model.Clear(); //禁用右键 this.MinimumSize = new Size(1000, 700); this.MaximumSize = new Size(1000, 700); this.FormBorderStyle = FormBorderStyle.FixedToolWindow; //注册显示注册界面事件到JS base.GlobalObject.AddFunction("showRegistered").Execute += (_, args) => { this.RequireUIThread(() => { }); }; //注册显示主界 面窗体到JS base.GlobalObject.AddFunction("viewMain").Execute += (_, args) => { this.RequireUIThread(() => { //Application.Run(new Main()); //this.Close(); //this.Dispose(); //this.DialogResult = DialogResult.OK; //new Main(this).Show(); //this.Close(); }); }; var FuncExport = GlobalObject.AddFunction("Func_Export"); FuncExport.Execute += (func, args) => { var stringArgument = args.Arguments.FirstOrDefault(p => p.IsString); if (stringArgument != null) { var str = stringArgument.StringValue; str = str.Replace("ind", "序号"); str = str.Replace("one", "数字"); str = str.Replace("two", "排序"); str = str.Replace("three", "正负"); ExportList tables = Newtonsoft.Json.JsonConvert.DeserializeObject <ExportList>(str); //导出五个表 var saveDir = System.Environment.CurrentDirectory; string currDate = DateTime.Now.ToString("yyyy-MM-dd"); string currTime = DateTime.Now.ToString("HH-mm"); if (!Directory.Exists(saveDir + "\\数据表格")) { Directory.CreateDirectory(saveDir + "\\数据表格"); } if (!Directory.Exists(saveDir + "\\数据表格\\" + currDate)) { Directory.CreateDirectory(saveDir + "\\数据表格\\" + currDate); } try { var path = saveDir + "\\数据表格\\" + currDate; //if (tables.table1 != null && tables.table1.Rows.Count > 0) FileHelper.ExportExcel(path + "\\千位" + currTime + "正比率" + GetPrecent(tables.table1) + ".xls", tables.table1, ""); //if (tables.table2 != null && tables.table2.Rows.Count > 0) FileHelper.ExportExcel(path + "\\百位" + currTime + "正比率" + GetPrecent(tables.table2) + ".xls", tables.table2, ""); //if (tables.table3 != null && tables.table3.Rows.Count > 0) FileHelper.ExportExcel(path + "\\十位" + currTime + "正比率" + GetPrecent(tables.table3) + ".xls", tables.table3, ""); //if (tables.table4 != null && tables.table4.Rows.Count > 0) FileHelper.ExportExcel(path + "\\个位" + currTime + "正比率" + GetPrecent(tables.table4) + ".xls", tables.table4, ""); //if (tables.table5 != null && tables.table5.Rows.Count > 0) FileHelper.ExportExcel(path + "\\球五" + currTime + "正比率" + GetPrecent(tables.table5) + ".xls", tables.table5, ""); var resultStr = CfrV8Value.CreateString(Newtonsoft.Json.JsonConvert.SerializeObject(true)); args.SetReturnValue(resultStr); } catch { var resultStr = CfrV8Value.CreateString(Newtonsoft.Json.JsonConvert.SerializeObject(false)); args.SetReturnValue(resultStr); } } }; //注册最小化事件到JS base.GlobalObject.AddFunction("minForm").Execute += (_, args) => this.RequireUIThread(() => this.WindowState = FormWindowState.Minimized); //注册最大化事件到JS base.GlobalObject.AddFunction("maxForm").Execute += (_, args) => this.RequireUIThread(() => this.WindowState = FormWindowState.Maximized); //注册默认大小事件到JS base.GlobalObject.AddFunction("normalForm").Execute += (_, args) => this.RequireUIThread(() => this.WindowState = FormWindowState.Normal); //注册关闭窗体事件到JS base.GlobalObject.AddFunction("closeForm").Execute += (_, args) => { this.RequireUIThread(() => { this.Close(); this.Dispose(); Application.Exit(); }); }; this.Visible = true; //#if DEBUG // base.LoadHandler.OnLoadStart += (sender, e) => // { // base.Chromium.ShowDevTools(); // }; //#endif }
public void AddExportItem(string name) { ExportList.Add(new ExportItem(name)); }
/// <summary> /// Initialize the <see cref="Package"/> by reading from the given filename. /// </summary> /// <param name="state">The <see cref="State"/> this <see cref="Package"/> is to exist within.</param> /// <param name="fileName">The name of the file to open that contains the <see cref="Package"/>.</param> /// <param name="reader">The <see cref="BinaryReader"/> to read from.</param> public Package(State state, string fileName, BinaryReader reader) { if (state == null) throw new ArgumentNullException("state"); if (reader == null) throw new ArgumentNullException("reader"); if (reader.ReadInt32() != Magic) throw new Exception("Unreal package magic test failed."); Reader = reader; FileName = fileName; Export = new Unreal.Export(this, -1); Export.Name = Path.GetFileNameWithoutExtension(fileName); Export.LoadedObject = this; StateValue = state; FileVersion = reader.ReadUInt16(); LicenseMode = reader.ReadUInt16(); Flags = (PackageFlag)reader.ReadUInt32(); var nameCount = reader.ReadInt32(); var nameOffset = reader.ReadUInt32(); var exportCount = reader.ReadInt32(); var exportOffset = reader.ReadUInt32(); var importCount = reader.ReadInt32(); var importOffset = reader.ReadUInt32(); if (FileVersion >= 68) Guid = new Guid(reader.ReadBytes(16)); Imports = new ImportList(importCount); for (var index = 0; index < importCount; index++) Imports.Add(new Import(this, index)); Exports = new ExportList(exportCount); for (var index = 0; index < exportCount; index++) Exports.Add(new Export(this, index)); Names = new NameList(nameCount); reader.BaseStream.Position = nameOffset; for (var index = 0; index < nameCount; index++) Names.Add(new Name(this, reader)); reader.BaseStream.Position = exportOffset; for (var index = 0; index < exportCount; index++) Exports[index].Load(reader); reader.BaseStream.Position = importOffset; for (var index = 0; index < importCount; index++) Imports[index].Load(reader); FilteredExports = new ExportList(exportCount); foreach (var export in Exports) { /*if(export.ObjectClassReference != null && export.ObjectClassReference.Name.EndsWith("Property")) { if(((((Alexandria.Engines.Unreal.Core.Property)export.Object).PropertyFlags) & Alexandria.Engines.Unreal.Core.PropertyFlag.Test) != 0) FilteredExports.Add(export); }*/ if (export.ObjectClassReference == null || !export.ObjectClassReference.Name.EndsWith("Property")) FilteredExports.Add(export); } Game = DetermineGame(FileVersion, LicenseMode, IsEncrypted); }
public ActionResult ExportPDF(string[] region, string[] country, string[] sector, string[] document, string[] year, string[] period, string[] last_Update, string[] counterpart, string[] DocCheckboxData, string[] thematicCheckboxData, string[] designProcessCheckboxData, string[] pagesize, string[] page, int?sortColumnIndex, int?sortDirection, string filetype) { SearchMapModel model = new SearchMapModel(); #region [Page] int pageSize = 20000; //if (pagesize != null) //{ // int.TryParse(pagesize[0], out pageSize); //} int Pages = 1; if (page != null) { int.TryParse(page[0], out Pages); } #endregion SearchAttributes searchParam = new SearchAttributes(); searchParam.CurrentPageNumber = Pages; // searchParam.RecordsPerPage = AppSettingsUtility.GetInt(AppSettingsKeys.RecordsPerPage); searchParam.RecordsPerPage = pageSize; if (sortColumnIndex.HasValue) { searchParam.SortColumnIndex = sortColumnIndex.Value; } else { searchParam.SortColumnIndex = 1; } searchParam.SortDirection = (sortDirection.HasValue && sortDirection.Value == 1) ? Entity.SortDirection.Descending : Entity.SortDirection.Ascending; model.SearchParam = searchParam; List <ExportRecordData> exportRecordData = new List <ExportRecordData>(); exportRecordData = model.GetExportFilteredData(region, country, sector, document, year, period, last_Update, counterpart, DocCheckboxData, thematicCheckboxData, designProcessCheckboxData, pageSize, model.SearchParam, sortColumnIndex, sortDirection); ExportList <ExportRecordData> exp = new ExportList <ExportRecordData>(); string filePathExport = string.Empty; exp.PathTemplateFolder = Server.MapPath("~/ExportTemplates/"); if (filetype == "excel") { filePathExport = Server.MapPath("~/ExportFiles/" + DateTime.Now.Ticks + ".xlsx"); exp.ExportTo(exportRecordData, ExportToFormat.Excel2007, filePathExport); } else if (filetype == "pdf") { filePathExport = Server.MapPath("~/ExportFiles/" + DateTime.Now.Ticks + ".csv"); exp.ExportTo(exportRecordData, ExportToFormat.CSV, filePathExport); } else if (filetype == "csv") { filePathExport = Server.MapPath("~/ExportFiles/" + DateTime.Now.Ticks + ".csv"); exp.ExportTo(exportRecordData, ExportToFormat.CSV, filePathExport); } else { filePathExport = Server.MapPath("~/ExportFiles/" + DateTime.Now.Ticks + ".csv"); exp.ExportTo(exportRecordData, ExportToFormat.CSV, filePathExport); } //return this.File(filePathExport, "application/octet-stream", System.IO.Path.GetFullPath(filePathExport)); return(Json(new { fileurl = "/ExportFiles/" + System.IO.Path.GetFileName(filePathExport) }, JsonRequestBehavior.AllowGet)); }
internal protected void Add(string name, DyObject obj) { ExportList.Add(name, new ScopeVar(0 | ExportList.Count << 8, VarFlags.Foreign)); Values.Add(obj); }