public StiNetCoreActionResult ExportReport(StiReport report, string format) { StiNetCoreActionResult result; switch (format) { case "pdf": result = StiNetCoreReportResponse.ResponseAsPdf(report); break; case "html": result = StiNetCoreReportResponse.PrintAsHtml(report); break; case "xls": result = StiNetCoreReportResponse.ResponseAsXls(report); break; case "xml": result = StiNetCoreReportResponse.ResponseAsXml(report); break; case "doc": result = StiNetCoreReportResponse.ResponseAsWord2007(report); break; default: throw new Exception("Недопустимый формат файла"); } return(result); }
public IActionResult PrintToPDF(string reportPath, string dataKey = null) { if (!string.IsNullOrWhiteSpace(reportPath)) { EnsureAllowAccess(reportPath); var report = new StiReport(); string contentRootPath = _hostingEnvironment.ContentRootPath; Stimulsoft.Base.StiLicense.LoadFromFile(contentRootPath + "/Stimulsoft/license.key"); report.Load(StiNetCoreHelper.MapPath(this, reportPath)); report.Dictionary.Variables["OrganizationName"].Value = "AwroNore"; report.Dictionary.Variables["OrganizationLogo"].Value = $"{Request.Scheme}://{Request.Host}{""}"; if (!string.IsNullOrWhiteSpace(dataKey)) { var reportDatasource = _context.HttpContext.Session.Get <List <ReportDatasourceModel> >(dataKey); foreach (var item in reportDatasource) { report.RegData(item.Name, item.Name, item.Value); } report.Render(); } return(StiNetCoreReportResponse.PrintAsPdf(report)); } else { //Raise error path is empty; return(null); } }
public IActionResult PrintB() { StiReport sti = new StiReport(); sti.Load(StiNetCoreHelper.MapPath(this, "wwwroot/Report/address.mrt")); //var ppp = _context.Factor1 // .Include(f => f.IdfactorstateNavigation) // .Include(a => a.IdproductaddressNavigation) // .FirstAsync(); var addres = _context.Productaddresses.ToList(); sti.Dictionary.Variables["variableName"].Value = "Yar"; var report = StiReport.CreateNewReport(); var path = StiNetCoreHelper.MapPath(this, "wwwroot/Report/address.mr"); report.Load(path); return(StiNetCoreReportResponse.ResponseAsPdf(report)); //sti.RegData("st", addres); return(StiNetCoreViewer.GetReportResult(this, sti)); }
public IActionResult ExportImage() { var report = this.GetDashboard(); return(StiNetCoreReportResponse.ResponseAsPng(report)); }
public IActionResult ExportExcel() { var report = this.GetDashboard(); return(StiNetCoreReportResponse.ResponseAsExcel2007(report)); }
public IActionResult PrintPdf() { var report = this.GetDashboard(); return(StiNetCoreReportResponse.PrintAsPdf(report)); }
public IActionResult ExportXls() { var report = this.GetReport(); return(StiNetCoreReportResponse.ResponseAsXls(report)); }
public IActionResult PrintHtml() { var report = this.GetReport(); return(StiNetCoreReportResponse.PrintAsHtml(report)); }
public IActionResult ExportReport() { StiReport report = LoadReport(); return(StiNetCoreReportResponse.ResponseAsPdf(report)); }
public ActionResult ExportPng() { StiReport report = this.GetReport(); return(StiNetCoreReportResponse.ResponseAsPng(report)); }
public IActionResult ExportHtml() { StiReport report = this.GetReport(); return(StiNetCoreReportResponse.ResponseAsHtml(report)); }
public IActionResult PrintPdf() { StiReport report = this.GetReport(); return(StiNetCoreReportResponse.PrintAsPdf(report)); }
public IActionResult PurchaseStatisticsBPrint(SearchFormModel model) { model.Type = (int)Constants.PurchaseType.B; var result = _unitOfWork.PurchaseStatisticsRepository.GetListOfContractByPurchaseStatisticsCd(model); var reportLocation = "./wwwroot/report/PurchaseStatisticsBReport.mrt"; var report = new StiReport(); StiFontCollection.AddFontFile("./wwwroot/assets/fonts/meiryo/Meiryo W53 Regular.ttf", "Meiryo"); StiFontCollection.AddFontFile("./wwwroot/assets/fonts/meiryo/MeiryoUI-Bold.ttf", "Meiryo UI"); report.Load(reportLocation); report.ReportName = string.Concat("購入者リスト集計表 B_", DateTime.Now.ToString(Constants.ExactDateTimeFormat)); report["EventName"] = $"【{result.EventName}】"; report["EventAddress"] = result.EventAddress + (string.IsNullOrEmpty(result.EventPlace) ? string.Empty : $"({result.EventPlace})"); report["PeriodTime"] = result.PeriodTime; report["EventManager"] = result.EventManagerString; report["InputPerson"] = result.InputPersonString; var content = report.Pages["content"]; var border = new StiBorder(StiBorderSides.All, Color.Black, 1, StiPenStyle.Solid); double top = .2, left = 0, basicWidth = .4, basicHeight = .2; var countDays = (result.EndDate - result.StartDate).TotalDays + 1; var dynamicWidth = Math.Round(basicWidth + (7 - countDays) * 1.4 / countDays / 3, 2); DrawTitleB(content, result.StartDate, result.EndDate, dynamicWidth); foreach (var artist in result.ArtistsTotal) { artist.MaxCell = artist.MaxCell < 6 ? 6 : artist.MaxCell; while (artist.MaxCell % 3 != 0) { artist.MaxCell++; } var artistName = new StiText(new RectangleD(left, top, 1.2, Math.Round((double)artist.MaxCell / 3) * .2 + basicHeight)) { Text = artist.ArtistName, Font = new Font("Meiryo", 6), WordWrap = true, Border = border, HorAlignment = StiTextHorAlignment.Center, VertAlignment = StiVertAlignment.Center }; content.Components.Add(artistName); left += artistName.Width; for (var date = result.StartDate; date.Date <= result.EndDate.Date; date = date.AddDays(1)) { var cell = result.RowDetails.FirstOrDefault(x => x.ArtistCd == artist.ArtistCd && x.HoldDate.Date.CompareTo(date.Date) == 0); var emptyText = new StiText(new RectangleD(left, top + artistName.Height - basicHeight, dynamicWidth, basicHeight)) { Text = string.Empty, Border = border, }; content.Components.Add(emptyText); var numberOfContracts = new StiText(new RectangleD(left + dynamicWidth, top + artistName.Height - basicHeight, dynamicWidth, basicHeight)) { Text = (cell?.NumberOfContracts ?? 0).ToString(), Font = new Font("Meiryo", 5), WordWrap = true, Border = border, HorAlignment = StiTextHorAlignment.Right, VertAlignment = StiVertAlignment.Center, Margins = new StiMargins(0, 2, 0, 0) }; content.Components.Add(numberOfContracts); var totalPriceOfContracts = new StiText(new RectangleD(left + dynamicWidth * 2, top + artistName.Height - basicHeight, dynamicWidth, basicHeight)) { Text = (cell?.TotalPriceOfContracts ?? 0).ToString(Constants.CurrencyFormat), Font = new Font("Meiryo", 5), Border = border, HorAlignment = StiTextHorAlignment.Right, VertAlignment = StiVertAlignment.Center, Margins = new StiMargins(0, 2, 0, 0), ShrinkFontToFit = true, ShrinkFontToFitMinimumSize = 4 }; content.Components.Add(totalPriceOfContracts); double topPrice = top, leftPrice = left; for (var i = 0; i < artist.MaxCell; i++) { var rec = new RectangleD(leftPrice, topPrice, dynamicWidth, basicHeight); var price = new StiText(rec) { Text = (cell == null || i >= cell.ContractPrices.Count) ? string.Empty : cell.ContractPrices[i].ToString(Constants.CurrencyFormat), Font = new Font("Meiryo", 5), WordWrap = true, Border = border, HorAlignment = StiTextHorAlignment.Right, VertAlignment = StiVertAlignment.Center, Margins = new StiMargins(0, 2, 0, 0) }; if ((i + 1) % 3 == 0) { leftPrice -= dynamicWidth * 2; topPrice += .2; } else { leftPrice += dynamicWidth; } content.Components.Add(price); } left += dynamicWidth * 3; } var totalContracts = new StiText(new RectangleD(left, top, .6, artistName.Height)) { Text = artist.TotalContracts.ToString(), Font = new Font("Meiryo", 5), WordWrap = true, Border = border, HorAlignment = StiTextHorAlignment.Center, VertAlignment = StiVertAlignment.Center }; content.Components.Add(totalContracts); left += .6; var subTotal = new StiText(new RectangleD(left, top, 1.1, artistName.Height)) { Text = artist.SubTotal.ToString(Constants.CurrencyFormat), Font = new Font("Meiryo", 5), Border = border, HorAlignment = StiTextHorAlignment.Right, VertAlignment = StiVertAlignment.Center, Margins = new StiMargins(0, 2, 0, 0), ShrinkFontToFit = true, ShrinkFontToFitMinimumSize = 4 }; content.Components.Add(subTotal); left = 0; top += artistName.Height; } var totalText = new StiText(new RectangleD(left, top, 1.2, basicHeight)) { Text = "合計", Font = new Font("Meiryo", 6), Border = border, HorAlignment = StiTextHorAlignment.Center, VertAlignment = StiVertAlignment.Center }; content.Components.Add(totalText); left += 1.2; for (var date = result.StartDate; date.Date <= result.EndDate.Date; date = date.AddDays(1)) { var cell = result.DateTotal.FirstOrDefault(x => date.Date.CompareTo(x.Date.Value.Date) == 0); var emptyText = new StiText(new RectangleD(left, top, dynamicWidth, basicHeight)) { Text = string.Empty, Border = border, }; content.Components.Add(emptyText); left += dynamicWidth; var numberOfContracts = new StiText(new RectangleD(left, top, dynamicWidth, basicHeight)) { Text = (cell?.TotalContracts ?? 0).ToString(), Font = new Font("Meiryo", 5), Border = border, HorAlignment = StiTextHorAlignment.Right, VertAlignment = StiVertAlignment.Center, Margins = new StiMargins(0, 2, 0, 0) }; content.Components.Add(numberOfContracts); left += dynamicWidth; var totalPriceOfContracts = new StiText(new RectangleD(left, top, dynamicWidth, basicHeight)) { Text = (cell?.SubTotal ?? 0).ToString(Constants.CurrencyFormat), Font = new Font("Meiryo", 5), Border = border, HorAlignment = StiTextHorAlignment.Right, VertAlignment = StiVertAlignment.Center, Margins = new StiMargins(0, 2, 0, 0), ShrinkFontToFit = true, ShrinkFontToFitMinimumSize = 4 }; content.Components.Add(totalPriceOfContracts); left += dynamicWidth; } var sumNumberOfContracts = new StiText(new RectangleD(left, top, .6, basicHeight)) { Text = result.ArtistsTotal.Sum(x => x.TotalContracts).ToString(), Font = new Font("Meiryo", 5), Border = border, HorAlignment = StiTextHorAlignment.Center, VertAlignment = StiVertAlignment.Center }; content.Components.Add(sumNumberOfContracts); left += sumNumberOfContracts.Width; var total = new StiText(new RectangleD(left, top, 1.1, basicHeight)) { Text = result.ArtistsTotal.Sum(x => x.SubTotal).ToString(Constants.CurrencyFormat), Font = new Font("Meiryo", 5), Border = border, HorAlignment = StiTextHorAlignment.Right, VertAlignment = StiVertAlignment.Center, Margins = new StiMargins(0, 2, 0, 0), ShrinkFontToFit = true, ShrinkFontToFitMinimumSize = 4 }; content.Components.Add(total); return(StiNetCoreReportResponse.PrintAsPdf(report)); }