You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
48 lines
1.4 KiB
48 lines
1.4 KiB
using System;
|
|
using System.Collections.Generic;
|
|
using System.Text;
|
|
using NPOI.Util;
|
|
using System.IO;
|
|
|
|
namespace TestCases.OpenXml4Net
|
|
{
|
|
public class OpenXml4NetTestDataSamples
|
|
{
|
|
private static POIDataSamples _samples = POIDataSamples.GetOpenXml4NetInstance();
|
|
|
|
private OpenXml4NetTestDataSamples()
|
|
{
|
|
// no instances of this class
|
|
}
|
|
|
|
public static Stream OpenSampleStream(String sampleFileName)
|
|
{
|
|
return _samples.OpenResourceAsStream(sampleFileName);
|
|
}
|
|
public static String GetSampleFileName(String sampleFileName)
|
|
{
|
|
return new FileInfo(_samples.ResolvedDataDir+sampleFileName).FullName;
|
|
}
|
|
|
|
public static FileInfo GetSampleFile(String sampleFileName)
|
|
{
|
|
return new FileInfo(_samples.ResolvedDataDir+sampleFileName);
|
|
}
|
|
|
|
public static FileInfo GetOutputFile(String outputFileName)
|
|
{
|
|
int dotPos = outputFileName.LastIndexOf('.');
|
|
String suffix = outputFileName.Substring(dotPos);
|
|
string path= TempFile.GetTempFilePath(outputFileName.Substring(0,dotPos), suffix);
|
|
FileStream fs = File.Create(path);
|
|
fs.Close();
|
|
return new FileInfo(path);
|
|
}
|
|
|
|
|
|
public static Stream OpenComplianceSampleStream(String sampleFileName)
|
|
{
|
|
return _samples.OpenResourceAsStream(sampleFileName);
|
|
}
|
|
}
|
|
}
|
|
|