本文整理汇总了C#中ExportOptions类的典型用法代码示例。如果您正苦于以下问题:C# ExportOptions类的具体用法?C# ExportOptions怎么用?C# ExportOptions使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
ExportOptions类属于命名空间,在下文中一共展示了ExportOptions类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: GenerateWord
private void GenerateWord()
{
ReportDocument rpt = new ReportDocument();
rpt.Load(Server.MapPath(Constants.ROOT_DIRECTORY + "/Reports/GeneralLedger.rpt"));
ExportOptions exportop = new ExportOptions();
DiskFileDestinationOptions dest = new DiskFileDestinationOptions();
string strPath = Server.MapPath(@"\retailplus\temp\");
string strFileName = "generalledger_" + Session["UserName"].ToString() + "_" + DateTime.Now.ToString("yyyyMMddhhmmssff") + ".doc";
if (System.IO.File.Exists(strPath + strFileName))
System.IO.File.Delete(strPath + strFileName);
dest.DiskFileName = strPath + strFileName;
exportop = rpt.ExportOptions;
SetDataSource(rpt);
exportop.DestinationOptions = dest;
exportop.ExportDestinationType = ExportDestinationType.DiskFile;
exportop.ExportFormatType = ExportFormatType.WordForWindows;
rpt.Export(); rpt.Close(); rpt.Dispose();
fraViewer.Attributes.Add("src","/retailplus/temp/" + strFileName);
}
示例2: GeneratePDF
private void GeneratePDF()
{
ReportDocument rpt = new ReportDocument();
rpt.Load(Server.MapPath(Constants.ROOT_DIRECTORY + "/Reports/ChartOfAccountsSummary.rpt"));
ExportOptions exportop = new ExportOptions();
DiskFileDestinationOptions dest = new DiskFileDestinationOptions();
string strPath = Server.MapPath(@"\RetailPlus\temp\");
string strFileName = "po_" + Session["UserName"].ToString() + "_" + DateTime.Now.ToString("yyyyMMddhhmmssff") + ".pdf";
if (System.IO.File.Exists(strPath + strFileName))
System.IO.File.Delete(strPath + strFileName);
dest.DiskFileName = strPath + strFileName;
exportop = rpt.ExportOptions;
SetDataSource(rpt);
exportop.DestinationOptions = dest;
exportop.ExportDestinationType = ExportDestinationType.DiskFile;
exportop.ExportFormatType = ExportFormatType.PortableDocFormat;
rpt.Export(); rpt.Close(); rpt.Dispose();
fraViewer.Attributes.Add("src","/RetailPlus/temp/" + strFileName);
}
示例3: ExportarEXCEL
private void ExportarEXCEL(ReportDocument rep)
{
String ruta_exportacion;
ruta_exportacion = Server.MapPath(System.Configuration.ConfigurationSettings.AppSettings["ruta_exportacion_pdf"]);
//ruta_exportacion = System.Configuration.ConfigurationSettings.AppSettings["ruta_exportacion_pdf"];
ExportOptions exportOpts = new ExportOptions();
DiskFileDestinationOptions diskOpts = new DiskFileDestinationOptions();
exportOpts = rep.ExportOptions;
exportOpts.ExportFormatType = ExportFormatType.Excel;
exportOpts.ExportDestinationType = ExportDestinationType.DiskFile;
diskOpts.DiskFileName = ruta_exportacion + Session.SessionID.ToString() + ".xls";
exportOpts.DestinationOptions = diskOpts;
rep.Export();
Response.ClearContent();
Response.ClearHeaders();
Response.AddHeader ("Content-Disposition", "attachment;filename=Morosidad.xls");
Response.ContentType = "application/vnd.ms-excel";
Response.WriteFile(diskOpts.DiskFileName.ToString());
Response.Flush();
Response.Close();
System.IO.File.Delete(diskOpts.DiskFileName.ToString());
}
示例4: exportResponses
public IEnumerable<SimpleNameValueCollection> exportResponses(ExportOptions exportOptions)
{
String authToken = new Authentication(exportOptions.getAPIUrl()).getAuthenticationToken(exportOptions.getUserName(), exportOptions.getPassword());
ServiceOperationResultOfPagedListResultOfTabularResponseExportDataVUqw3SxCVUqw3SxC serviceOperationResult =
client.ExportResponsesTabular(authToken,
exportOptions.getSurveyId(),
exportOptions.getPageNumber(),
exportOptions.getResultsPerPage(),
exportOptions.getFilterField(),
exportOptions.getFilterValue(),
exportOptions.getSortField(),
exportOptions.getSortAscending(),
exportOptions.getPeriod(),
exportOptions.getDtStart(),
exportOptions.getDtEnd(),
exportOptions.getDetailedResponseInfo(),
exportOptions.getDetailedUserInfo(),
exportOptions.getIncludeOpenEndedResults(),
exportOptions.getIncludeAliases(),
exportOptions.getIncludeHiddenItems(),
exportOptions.getIncludeIncompleteResponses(),
exportOptions.getStripHTMLTagsFromAnswers(),
exportOptions.getStripHTMLTagsFromQuestions(),
exportOptions.getMergeAnswersForSelectMany());
if (!serviceOperationResult.CallSuccess)
{ throw new System.ArgumentException(); }
return getServiceOperationResult(serviceOperationResult);
}
示例5: ExportarPDF
private void ExportarPDF(ReportDocument rep)
{
String ruta_exportacion;
ruta_exportacion = Server.MapPath(System.Configuration.ConfigurationSettings.AppSettings["ruta_exportacion_pdf"]);
//ruta_exportacion = System.Configuration.ConfigurationSettings.AppSettings["ruta_exportacion_pdf"];
ExportOptions exportOpts = new ExportOptions();
DiskFileDestinationOptions diskOpts = new DiskFileDestinationOptions();
exportOpts = rep.ExportOptions;
exportOpts.ExportFormatType = ExportFormatType.PortableDocFormat;
exportOpts.ExportDestinationType = ExportDestinationType.DiskFile;
diskOpts.DiskFileName = ruta_exportacion + Session.SessionID.ToString() + ".pdf";
exportOpts.DestinationOptions = diskOpts;
rep.Export();
Response.ClearContent();
Response.ClearHeaders();
Response.ContentType = "application/pdf";
Response.WriteFile(diskOpts.DiskFileName.ToString());
Response.Flush();
Response.Close();
System.IO.File.Delete(diskOpts.DiskFileName.ToString());
}
示例6: Write
public virtual void Write(ContentItem item, ExportOptions options, XmlTextWriter writer)
{
WriteSingleItem(item, options, writer);
foreach (ContentItem child in item.Children)
Write(child, options, writer);
}
示例7: Exportar
public void Exportar(string key)
{
try
{
ReportDocument objRpt = new ReportDocument();
DataSet ds = (DataSet)this.GetDataReport(key);
string reportPath = "C:\\Reportes\\CRTejTicket_rpt.rpt";
objRpt.Load(reportPath);
ExportOptions crExportOptions = new ExportOptions();
objRpt.SetDataSource(ds.Tables[0]);
SaveFileDialog saveFileDialog = new SaveFileDialog();
saveFileDialog.InitialDirectory = Environment.SpecialFolder.MyDocuments.ToString();
saveFileDialog.Filter = "Document (*.pdf)|*.PDF";
saveFileDialog.FilterIndex = 1;
saveFileDialog.FileName = "Etiqueta.pdf";
if (saveFileDialog.ShowDialog() == DialogResult.OK)
{
objRpt.ExportToDisk(ExportFormatType.PortableDocFormat, saveFileDialog.FileName); ;
}
crExportOptions = objRpt.ExportOptions;
objRpt.Export();
}
catch (Exception ex)
{
ex.ToString();
}
}
示例8: VistaPrevia
public void VistaPrevia(string key)
{
try
{
ReportDocument objRpt = new ReportDocument();
DataSet ds = (DataSet)this.GetDataReport(key);
//string reportPath = Application.StartupPath + "\\Reporte\\co_ordenCompra_rpt.rpt";
string reportPath = "C:\\Reportes\\CR_Cliente_rpt01.rpt";
objRpt.Load(reportPath);
DiskFileDestinationOptions crDiskFileDestinationOption = new DiskFileDestinationOptions();
PdfRtfWordFormatOptions crFormatTypeOption = new PdfRtfWordFormatOptions();
ExportOptions crExportOptions = new ExportOptions();
objRpt.SetDataSource(ds.Tables[0]);
string strfolder = "C:\\Reporte\\";
crDiskFileDestinationOption.DiskFileName = strfolder + "Cliente.pdf";
crExportOptions = objRpt.ExportOptions;
crExportOptions.ExportDestinationType = ExportDestinationType.DiskFile;
crExportOptions.ExportFormatType = ExportFormatType.PortableDocFormat;
crExportOptions.ExportDestinationOptions = crDiskFileDestinationOption;
crExportOptions.ExportFormatOptions = crFormatTypeOption;
crystalReportViewer1.ReportSource = objRpt;
//objRpt.Export();
}
catch (Exception ex)
{
ex.ToString();
}
}
示例9: WriteSingleItem
public virtual void WriteSingleItem(ContentItem item, ExportOptions options, XmlTextWriter writer)
{
using (ElementWriter itemElement = new ElementWriter("item", writer))
{
WriteDefaultAttributes(itemElement, item);
foreach (IXmlWriter xmlWriter in GetWriters(options))
xmlWriter.Write(item, writer);
}
}
示例10: GetChildren
internal static IEnumerable<ContentItem> GetChildren(ContentItem item, ExportOptions options)
{
if (!options.IsFlagSet(ExportOptions.ExcludePages) && !options.IsFlagSet(ExportOptions.ExcludeParts))
return item.Children;
else if (options.IsFlagSet(ExportOptions.ExcludePages))
return item.Children.Where(c => !c.IsPage);
else if (options.IsFlagSet(ExportOptions.ExcludeParts))
return item.Children.Where(c => c.IsPage);
return Enumerable.Empty<ContentItem>();
}
示例11: GeneratePlainText
public static string GeneratePlainText(Subtitle subtitle, ExportOptions exportOptions)
{
var sb = new StringBuilder();
foreach (Paragraph p in subtitle.Paragraphs)
{
if (exportOptions.ShowLineNumbers)
{
sb.Append(p.Number);
if (exportOptions.AddNewlineAfterLineNumber)
sb.AppendLine();
else
sb.Append(' ');
}
if (exportOptions.ShowTimecodes)
{
if (exportOptions.TimeCodeSrt)
sb.Append(p.StartTime + exportOptions.TimeCodeSeparator + p.EndTime);
else if (exportOptions.TimeCodeHHMMSSFF)
sb.Append(p.StartTime.ToHHMMSSFF() + exportOptions.TimeCodeSeparator + p.EndTime.ToHHMMSSFF());
else
sb.Append(p.StartTime.TotalMilliseconds + exportOptions.TimeCodeSeparator + p.EndTime.TotalMilliseconds);
if (exportOptions.AddNewlineAfterTimeCodes)
sb.AppendLine();
else
sb.Append(' ');
}
string s = p.Text;
if (exportOptions.RemoveStyling)
{
s = HtmlUtil.RemoveHtmlTags(s, true);
}
if (exportOptions.FormatUnbreak)
{
sb.Append(Utilities.UnbreakLine(s));
}
else
{
sb.Append(s);
}
if (exportOptions.AddNewAfterText)
sb.AppendLine();
if (exportOptions.AddNewAfterText2)
sb.AppendLine();
if (!exportOptions.AddNewAfterText && !exportOptions.AddNewAfterText2)
sb.Append(' ');
}
string text = sb.ToString().Trim();
if (exportOptions.FormatMergeAll)
{
text = text.Replace(Environment.NewLine, " ");
text = text.FixExtraSpaces();
}
return text;
}
示例12: GetWriters
private IEnumerable<IXmlWriter> GetWriters(ExportOptions options)
{
if ((options & ExportOptions.OnlyDefinedProperties) == ExportOptions.OnlyDefinedProperties)
yield return new DefinedPropertyXmlWriter(definitions);
else
yield return new PropertyXmlWriter();
yield return new PropertyCollectionXmlWriter();
yield return new ChildXmlWriter();
yield return new AuthorizationRuleXmlWriter();
yield return new LanguageSettingXmlWriter();
}
示例13: GetWriters
private IEnumerable<IXmlWriter> GetWriters(ExportOptions options)
{
if((options & ExportOptions.OnlyDefinedDetails) == ExportOptions.OnlyDefinedDetails)
yield return new DefinedDetailXmlWriter(definitions);
else
yield return new DetailXmlWriter();
yield return new DetailCollectionXmlWriter();
yield return new ChildXmlWriter();
yield return new AuthorizationXmlWriter();
if ((options & ExportOptions.ExcludeAttachments) == ExportOptions.Default)
yield return new AttachmentXmlWriter();
}
示例14: Export
public virtual void Export(ContentItem item, ExportOptions options, HttpResponse response)
{
response.ContentType = GetContentType();
response.AppendHeader("Content-Disposition", "attachment;filename=" + GetExportFilename(item));
using (var output = GetTextWriter(response))
{
Export(item, options, output);
output.Flush();
}
response.End();
}
示例15: GenerateReport
public static void GenerateReport(string FileName, ReportDocument rpt, System.Web.UI.Control ClientScriptBlockControl, ExportFormatType pvtExportFormatType)
{
try
{
ExportOptions exportop = new ExportOptions();
DiskFileDestinationOptions dest = new DiskFileDestinationOptions();
string strFileExtensionName = ".pdf";
switch (pvtExportFormatType)
{
case ExportFormatType.PortableDocFormat: strFileExtensionName = ".pdf"; exportop.ExportFormatType = ExportFormatType.PortableDocFormat; break;
case ExportFormatType.WordForWindows: strFileExtensionName = ".doc"; exportop.ExportFormatType = ExportFormatType.WordForWindows; break;
case ExportFormatType.Excel: strFileExtensionName = ".xls"; exportop.ExportFormatType = ExportFormatType.Excel; break;
}
string strPath = System.Web.HttpContext.Current.Server.MapPath(@"\retailplus\temp\");
string strFileName = FileName + "_" + DateTime.Now.ToString("yyyyMMddhhmmssff") + strFileExtensionName;
if (System.IO.File.Exists(strPath + strFileName))
System.IO.File.Delete(strPath + strFileName);
dest.DiskFileName = strPath + strFileName;
exportop.DestinationOptions = dest;
exportop.ExportDestinationType = ExportDestinationType.DiskFile;
rpt.Export(exportop); //rpt.Close(); rpt.Dispose();
// remove the error
if (pvtExportFormatType == ExportFormatType.WordForWindows || pvtExportFormatType == ExportFormatType.Excel || pvtExportFormatType == ExportFormatType.PortableDocFormat)
{
// the maximum report processing jobs limit configured by your system administrator has been reached.
rpt.Close(); rpt.Dispose();
}
if (pvtExportFormatType == ExportFormatType.PortableDocFormat)
{
string newWindowUrl = Constants.ROOT_DIRECTORY + "/temp/" + strFileName;
string javaScript = "window.open('" + newWindowUrl + "');";
System.Web.UI.ScriptManager.RegisterClientScriptBlock(ClientScriptBlockControl, ClientScriptBlockControl.GetType(), "openwindow", javaScript, true);
}
else
{
string newWindowUrl = Constants.ROOT_DIRECTORY + "/temp/" + strFileName;
string javaScript = "window.open('" + newWindowUrl + "','_self');";
System.Web.UI.ScriptManager.RegisterClientScriptBlock(ClientScriptBlockControl, ClientScriptBlockControl.GetType(), "openwindow", javaScript, true);
//System.Diagnostics.Process p = new System.Diagnostics.Process();
//p.StartInfo.FileName = System.Web.HttpContext.Current.Server.MapPath(Constants.ROOT_DIRECTORY + "/temp/" + strFileName);
//p.StartInfo.WindowStyle = System.Diagnostics.ProcessWindowStyle.Normal;
//p.Start();
}
}
catch (Exception ex) { throw ex; }
}