本文整理汇总了C#中File.getPos方法的典型用法代码示例。如果您正苦于以下问题:C# File.getPos方法的具体用法?C# File.getPos怎么用?C# File.getPos使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类File
的用法示例。
在下文中一共展示了File.getPos方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: SharedBooleanFormulaRecord
/**
* Constructs this number
*
* @param t the data
* @param excelFile the excel biff data
* @param v the value
* @param fr the formatting records
* @param es the external sheet
* @param nt the name table
* @param si the sheet
*/
public SharedBooleanFormulaRecord(Record t,
File excelFile,
bool v,
FormattingRecords fr,
ExternalSheet es,
WorkbookMethods nt,
SheetImpl si)
: base(t,fr,es,nt,si,excelFile.getPos())
{
value = v;
}
示例2: SharedErrorFormulaRecord
/**
* Constructs this number
*
* @param t the data
* @param excelFile the excel biff data
* @param v the errorCode
* @param fr the formatting records
* @param es the external sheet
* @param nt the name table
* @param si the sheet
*/
public SharedErrorFormulaRecord(Record t,
File excelFile,
int ec,
FormattingRecords fr,
ExternalSheet es,
WorkbookMethods nt,
SheetImpl si)
: base(t,fr,es,nt,si,excelFile.getPos())
{
errorCode = ec;
}
示例3: Record
/**
* Constructor
*
* @param offset the offset in the raw file
* @param f the excel 97 biff file
* @param d the data record
*/
public Record(byte[] d, int offset, File f)
{
code = IntegerHelper.getInt(d[offset],d[offset + 1]);
length = IntegerHelper.getInt(d[offset + 2],d[offset + 3]);
file = f;
file.skip(4);
dataPos = f.getPos();
file.skip(length);
type = Type.getType(code);
}
示例4: SharedStringFormulaRecord
/**
* Constructs this string formula
*
* @param t the record
* @param excelFile the excel file
* @param fr the formatting record
* @param es the external sheet
* @param nt the workbook
* @param si the sheet
* @param ws the workbook settings
*/
public SharedStringFormulaRecord(Record t,
File excelFile,
FormattingRecords fr,
ExternalSheet es,
WorkbookMethods nt,
SheetImpl si,
WorkbookSettings ws)
: base(t,fr,es,nt,si,excelFile.getPos())
{
int pos = excelFile.getPos();
// Save the position in the excel file
int filepos = excelFile.getPos();
// Look for the string record in one of the records after the
// formula. Put a cap on it to prevent ednas
Record nextRecord = excelFile.next();
int count = 0;
while (nextRecord.getType() != Type.STRING && count < 4)
{
nextRecord = excelFile.next();
count++;
}
Assert.verify(count < 4," @ " + pos);
byte[] stringData = nextRecord.getData();
// Read in any continuation records
nextRecord = excelFile.peek();
while (nextRecord.getType() == Type.CONTINUE)
{
nextRecord = excelFile.next(); // move the pointer within the data
byte[] d = new byte[stringData.Length + nextRecord.getLength() - 1];
System.Array.Copy(stringData,0,d,0,stringData.Length);
System.Array.Copy(nextRecord.getData(),1,d,
stringData.Length,nextRecord.getLength() - 1);
stringData = d;
nextRecord = excelFile.peek();
}
int chars = IntegerHelper.getInt(stringData[0],stringData[1]);
bool unicode = false;
int startpos = 3;
if (stringData.Length == chars + 2)
{
// string might only consist of a one byte length indicator, instead
// of the more normal 2
startpos = 2;
unicode = false;
}
else if (stringData[2] == 0x1)
{
// unicode string, two byte length indicator
startpos = 3;
unicode = true;
}
else
{
// ascii string, two byte length indicator
startpos = 3;
unicode = false;
}
if (!unicode)
{
value = StringHelper.getString(stringData,chars,startpos,ws);
}
else
{
value = StringHelper.getUnicodeString(stringData,chars,startpos);
}
// Restore the position in the excel file, to enable the SHRFMLA
// record to be picked up
excelFile.setPos(filepos);
}
示例5: SharedNumberFormulaRecord
/**
* Constructs this number
*
* @param t the data
* @param excelFile the excel biff data
* @param v the value
* @param fr the formatting records
* @param es the external sheet
* @param nt the name table
* @param si the sheet
*/
public SharedNumberFormulaRecord(Record t,
File excelFile,
double v,
FormattingRecords fr,
ExternalSheet es,
WorkbookMethods nt,
SheetImpl si)
: base(t,fr,es,nt,si,excelFile.getPos())
{
value = v;
format = defaultFormat; // format is set up later from the
// SharedFormulaRecord
}
示例6: StringFormulaRecord
/**
* Constructs this object from the raw data. We need to use the excelFile
* to retrieve the string record which follows this formula record
*
* @param t the raw data
* @param excelFile the excel file
* @param fr the formatting records
* @param es the external sheet records
* @param nt the workbook
* @param si the sheet impl
* @param ws the workbook settings
*/
public StringFormulaRecord(Record t,File excelFile,
FormattingRecords fr,
ExternalSheet es,
WorkbookMethods nt,
SheetImpl si,
WorkbookSettings ws)
: base(t,fr,si)
{
externalSheet = es;
nameTable = nt;
data = getRecord().getData();
int pos = excelFile.getPos();
// Look for the string record in one of the records after the
// formula. Put a cap on it to prevent looping
Record nextRecord = excelFile.next();
int count = 0;
while (nextRecord.getType() != Type.STRING && count < 4)
{
nextRecord = excelFile.next();
count++;
}
Assert.verify(count < 4," @ " + pos);
byte[] stringData = nextRecord.getData();
// Read in any continuation records
nextRecord = excelFile.peek();
while (nextRecord.getType() == Type.CONTINUE)
{
nextRecord = excelFile.next(); // move the pointer within the data
byte[] d = new byte[stringData.Length + nextRecord.getLength() - 1];
System.Array.Copy(stringData,0,d,0,stringData.Length);
System.Array.Copy(nextRecord.getData(),1,d,
stringData.Length,nextRecord.getLength() - 1);
stringData = d;
nextRecord = excelFile.peek();
}
readString(stringData,ws);
}