This commit is contained in:
2009-11-03 16:31:30 +00:00
parent 27cb94f418
commit afc16fb9f9
6 changed files with 102 additions and 48 deletions

View File

@@ -68,6 +68,32 @@ namespace DataLoader
* "Special Landscape, Elite, 6 lines per inch"
*/
if (stype != null)
{
// stype[1] == 'p' or 'P' or '6' 'f' or 'L' get spc = 6
int lpi = 6;
if (stype[1] == '*') lpi = 8;
else if (stype[1] == '4') lpi = 4;
else if (stype[1] == '7') lpi = 7;
// if need landscape set too: bool landscape = (stype[1] == 'L');
d.SetLineSpacing(lpi); // if need landscape set too: , landscape); ;
}
string temppath = Path.GetTempFileName();
/* 16-bit's type[1] used the following codes to represent the respective lpi setting
*
* char far typestr[] = "*pP46f7L";
*
* char * far printtypes[] = {
* "Compressed, 8 lines per inch",
* "Elite, 6 lines per inch",
* "Pica, 6 lines per inch",
* "Default font, 4 Lines Per Inch",
* "Default font, 6 Lines Per Inch",
* "Compressed 6 LPI",
* "Default font, 7 Lines Per Inch",
* "Special Landscape, Elite, 6 lines per inch"
*/
if (stype != null)
{
// stype[1] == 'p' or 'P' or '6' 'f' or 'L' get spc = 6
@@ -111,15 +137,19 @@ namespace DataLoader
string t1 = (title == null || title == "") ? null : title;
Document doc = Document.MakeDocument(t1, ByteArray, null, ci == null ? null : ci.ToString(), DateTime.Now, "Migration", ".Doc");
FileInfo tmpFile = new FileInfo(temppath);
FileInfo doctmpFile = tmpFile.CopyTo(temppath.Substring(0,temppath.LastIndexOf(".")) + @".doc");
doc.UpdateDocAscii(temppath.Substring(0, temppath.LastIndexOf(".")) + @".doc");
string docfile = temppath.Substring(0, temppath.LastIndexOf(".")) + @".doc";
if (File.Exists(docfile)) File.Delete(docfile);
FileInfo doctmpFile = tmpFile.CopyTo(docfile);
doc.UpdateDocAscii(docfile);
doc.Save();
File.Delete(docfile);
DocumentInfo di = DocumentInfo.Get(doc.DocID);
return doc.DocID;
}
// for an io exception, keep trying
catch (IOException)
catch (IOException exio)
{
Console.WriteLine("IO: {0} - {1}", exio.GetType().Name, exio.Message);
Wait(2);
return 0;
}
@@ -143,4 +173,4 @@ namespace DataLoader
return done;
}
}
}
}