本文整理汇总了C#中ExportFormat类的典型用法代码示例。如果您正苦于以下问题:C# ExportFormat类的具体用法?C# ExportFormat怎么用?C# ExportFormat使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
ExportFormat类属于命名空间,在下文中一共展示了ExportFormat类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: ExportDetails
// Function : ExportDetails
// Arguments : DetailsTable, FormatType, FileName
// Purpose : To get all the column headers in the datatable and
// exorts in CSV / Excel format with all columns
public void ExportDetails(DataTable DetailsTable, ExportFormat FormatType, string FileName)
{
try
{
if (DetailsTable.Rows.Count == 0)
throw new Exception("There are no details to export.");
// Create Dataset
DataSet dsExport = new DataSet("Export");
DataTable dtExport = DetailsTable.Copy();
dtExport.TableName = "Values";
dsExport.Tables.Add(dtExport);
// Getting Field Names
string[] sHeaders = new string[dtExport.Columns.Count];
string[] sFileds = new string[dtExport.Columns.Count];
for (int i = 0; i < dtExport.Columns.Count; i++)
{
//sHeaders[i] = ReplaceSpclChars(dtExport.Columns[i].ColumnName);
sHeaders[i] = dtExport.Columns[i].ColumnName;
sFileds[i] = ReplaceSpclChars(dtExport.Columns[i].ColumnName);
}
if (appType == "Web")
Export_with_XSLT_Web(dsExport, sHeaders, sFileds, FormatType, FileName);
else if (appType == "Win")
Export_with_XSLT_Windows(dsExport, sHeaders, sFileds, FormatType, FileName);
}
catch (Exception Ex)
{
throw Ex;
}
}
示例2: ExportStylesheet
private async static Task<string> ExportStylesheet(IEnumerable<SpriteFragment> fragments, SpriteDocument sprite, string imageFile, ExportFormat format)
{
string outputFile = GetFileName(imageFile, sprite, format);
var outputDirectory = Path.GetDirectoryName(outputFile);
StringBuilder sb = new StringBuilder().AppendLine(GetDescription(format));
string root = ProjectHelpers.GetRootFolder();
foreach (SpriteFragment fragment in fragments)
{
var rootAbsoluteUrl = FileHelpers.RelativePath(root, fragment.FileName);
var bgUrl = sprite.UseAbsoluteUrl ? "/" + FileHelpers.RelativePath(root, imageFile) : FileHelpers.RelativePath(outputFile, imageFile);
sb.AppendLine(GetSelector(rootAbsoluteUrl, sprite, format) + " {");
sb.AppendLine("/* You may have to set 'display: block' */");
sb.AppendLine("\twidth: " + fragment.Width + "px;");
sb.AppendLine("\theight: " + fragment.Height + "px;");
sb.AppendLine("\tbackground: url('" + bgUrl + "') -" + fragment.X + "px -" + fragment.Y + "px;");
sb.AppendLine("}");
}
bool IsExists = System.IO.Directory.Exists(outputDirectory);
if (!IsExists)
System.IO.Directory.CreateDirectory(outputDirectory);
ProjectHelpers.CheckOutFileFromSourceControl(outputFile);
await FileHelpers.WriteAllTextRetry(outputFile, sb.ToString().Replace("-0px", "0"));
return outputFile;
}
示例3: GetExportFormatString
/// <summary>
/// Gets the string export format of the specified enum.
/// </summary>
/// <param name="f">export format enum</param>
/// <returns>enum equivalent string export format</returns>
public static string GetExportFormatString(ExportFormat f)
{
int V_SQLServer = SetSQLServerVersion();
switch (f)
{
case ExportFormat.XML:
return "XML";
case ExportFormat.CSV:
return "CSV";
case ExportFormat.Image:
return "IMAGE";
case ExportFormat.PDF:
return "PDF";
case ExportFormat.MHTML:
return "MHTML";
case ExportFormat.HTML4:
return "HTML4.0";
case ExportFormat.HTML32:
return "HTML3.2";
case ExportFormat.Excel:
return V_SQLServer <= 2008 ? "EXCEL" : "EXCELOPENXML";
case ExportFormat.Excel_2003:
return "EXCEL";
case ExportFormat.Word:
return V_SQLServer <= 2008 ? "WORD" : "WORDOPENXML";
case ExportFormat.Word_2003:
return "WORD";
default:
return "PDF";
} // End switch (f)
}
示例4: LoadModel
public static Root LoadModel(string inputPath, ExportFormat format)
{
switch (format)
{
case ExportFormat.GR2:
{
using (var fs = new FileStream(inputPath, FileMode.Open, System.IO.FileAccess.Read, FileShare.ReadWrite))
{
var root = new LSLib.Granny.Model.Root();
var gr2 = new LSLib.Granny.GR2.GR2Reader(fs);
gr2.Read(root);
root.PostLoad();
return root;
}
}
case ExportFormat.DAE:
{
var root = new LSLib.Granny.Model.Root();
root.ImportFromCollada(inputPath);
return root;
}
default:
throw new ArgumentException("Invalid model format");
}
}
示例5: ExportDWGData
/// <summary>
/// Constructor
/// </summary>
/// <param name="commandData">Revit command data</param>
/// <param name="exportFormat">Format to export</param>
public ExportDWGData(ExternalCommandData commandData, ExportFormat exportFormat)
: base(commandData, exportFormat)
{
m_exportOptionsData = new ExportBaseOptionsData();
Initialize();
}
示例6: ExportDataWithViews
/// <summary>
/// Constructor
/// </summary>
/// <param name="commandData">Revit command data</param>
/// <param name="exportFormat">Format to export</param>
public ExportDataWithViews(ExternalCommandData commandData, ExportFormat exportFormat)
: base(commandData, exportFormat)
{
m_selectViewsData = new SelectViewsData(commandData);
Initialize();
}
示例7: btnCancel_Click
private void btnCancel_Click(object sender, EventArgs e)
{
IsOK = false;
ExportContent = ExportContent.None;
ExportFormat = ExportFormat.None;
ExportPath = "";
Close();
}
示例8: Create
/// <summary>
/// 创建导出
/// </summary>
/// <param name="format">导出格式</param>
public IExport Create( ExportFormat format ) {
switch( format ) {
case ExportFormat.Xlsx:
return CreateNpoiExcel2007Export();
case ExportFormat.Xls:
return CreateNpoiExcel2003Export();
}
throw new NotImplementedException();
}
示例9: Export
public static string Export(IEnumerable<SpriteFragment> fragments, string imageFile, ExportFormat format)
{
if (format == ExportFormat.Json)
{
return ExportJson(fragments, imageFile);
}
return ExportStylesheet(fragments, imageFile, format);
}
示例10: GetExporter
public static IExporter GetExporter(ExportFormat fmt)
{
switch (fmt)
{
case ExportFormat.Txt: return new ExporterTxt(CreateView());
case ExportFormat.Radb: return new ExporterRadb(CreateView());
default: throw new ArgumentException("Specified format is not supported.");
}
}
示例11: GetDescription
private static string GetDescription(ExportFormat format)
{
string text = "This is an example of how to use the image sprite in your own CSS files";
if (format != ExportFormat.Css)
text = "@import this file directly into your existing " + format + " files to use these mixins";
return "/*" + Environment.NewLine + text + Environment.NewLine + "*/";
}
示例12: Export
public async static Task<string> Export(IEnumerable<SpriteFragment> fragments, SpriteDocument sprite, string imageFile, ExportFormat format)
{
if (format == ExportFormat.Json)
{
return ExportJson(fragments, sprite, imageFile);
}
return await ExportStylesheet(fragments, sprite, imageFile, format);
}
示例13: ReportFormatInfo
public ReportFormatInfo(ExportFormat pFormat)
{
switch (pFormat)
{
case ExportFormat.Excel:
this.Extension = ".xls";
this.FormatName = "EXCEL";
this.Mime = @"application/vnd.ms-excel";
this.Format = pFormat;
break;
case ExportFormat.PDF:
this.Extension = ".pdf";
this.FormatName = "PDF";
this.Mime = "application/pdf";
this.Format = pFormat;
break;
case ExportFormat.Html:
this.Extension = ".htm";
this.FormatName = "HTML4.0";
this.Mime = "text/html";
this.Format = pFormat;
break;
case ExportFormat.HtmlFragment:
this.Extension = ".htm";
this.FormatName = "HTML4.0";
this.Mime = "text/html";
this.Format = pFormat;
// https://msdn.microsoft.com/en-us/library/ms155395.aspx
// #oReportCell { width: 100%; }
// JavaScript: Indicates whether JavaScript is supported in the rendered report.
// The default value is true.
// HTMLFragment: Indicates whether an HTML fragment is created in place of a full HTML document.
// An HTML fragment includes the report content in a TABLE element and omits the HTML and BODY elements.
// The default value is false.
// StyleStream: Indicates whether styles and scripts are created as a separate stream instead of in the document.
// The default value is false.
// StreamRoot: The path used for prefixing the value of the src attribute of the IMG element in the HTML report returned by the report server.
// By default, the report server provides the path.
// You can use this setting to specify a root path for the images in a report (for example, http://<servername>/resources/companyimages).
// <StreamRoot>/ReportServer/Resources</StreamRoot>
this.DeviceInfo = @"<DeviceInfo><HTMLFragment>True</HTMLFragment><JavaScript>false</JavaScript><StyleStream>true</StyleStream></DeviceInfo>";
break;
case ExportFormat.Image:
this.Extension = ".tif";
this.FormatName = "IMAGE";
this.Mime = "image/tiff";
this.Format = ExportFormat.PDF;
break;
default:
this.Extension = ".pdf";
this.FormatName = "PDF";
this.Mime = "application/pdf";
this.Format = ExportFormat.PDF;
break;
} // End Switch
}
示例14: _Export
public ActionResult _Export(string svg, ExportFormat format)
{
var svgText = HttpUtility.UrlDecode(svg);
var svgFile = TempFileName() + ".svg";
System.IO.File.WriteAllText(svgFile, svgText);
var outFile = DoExport(svgFile, format);
var attachment = "export" + Path.GetExtension(outFile);
return File(outFile, MimeTypes[format], attachment);
}
示例15: Export
/// <summary>
/// 导出SmartGridView的数据源的数据
/// </summary>
/// <param name="dt">数据源</param>
/// <param name="columnNameList">导出的列的列名数组</param>
/// <param name="exportFormat">导出文件的格式</param>
/// <param name="fileName">输出文件名</param>
/// <param name="encoding">编码</param>
public static void Export(DataTable dt, string[] columnNameList, ExportFormat exportFormat, string fileName, Encoding encoding)
{
List<int> columnIndexList = new List<int>();
DataColumnCollection dcc = dt.Columns;
foreach (string s in columnNameList)
{
columnIndexList.Add(GetColumnIndexByColumnName(dcc, s));
}
Export(dt, columnIndexList.ToArray(), exportFormat, fileName, encoding);
}