Added boolean parameter to SaveSectionDocument and SaveWordDoc methods to support landscape word documents

This commit is contained in:
Rich 2013-06-11 18:38:13 +00:00
parent 32ea07da99
commit d099c1a881

View File

@ -28,9 +28,9 @@ namespace DataLoader
{ {
public partial class Loader public partial class Loader
{ {
private void SaveSectionDocument(string fname, string stpseq, string stype, ref int cid, string sectName) private void SaveSectionDocument(string fname, string stpseq, string stype, ref int cid, string sectName, bool isLandscape)
{ {
int docid = SaveWordDoc(fname, stype, sectName); int docid = SaveWordDoc(fname, stype, sectName, isLandscape);
switch (docid) switch (docid)
{ {
case 0: case 0:
@ -47,7 +47,7 @@ namespace DataLoader
} }
} }
private int SaveWordDoc(string fname, string title, string stype, ConfigInfo ci, string sectName, DateTime dtsutc) private int SaveWordDoc(string fname, string title, string stype, bool isLandscape, ConfigInfo ci, string sectName, DateTime dtsutc)
{ {
int docid = 0; int docid = 0;
if (System.IO.File.Exists(fname)) if (System.IO.File.Exists(fname))
@ -66,7 +66,7 @@ namespace DataLoader
tmpFile.Delete(); tmpFile.Delete();
myFile.CopyTo(tmpName); myFile.CopyTo(tmpName);
LoadAndSaveRichTextBox41(tmpName); LoadAndSaveRichTextBox41(tmpName);
WordDocument wd = new WordDocument(tmpName, stype, temppath); WordDocument wd = new WordDocument(tmpName, stype, temppath, isLandscape);
Thread myThread = new Thread(wd.GetAsciiFromWord); Thread myThread = new Thread(wd.GetAsciiFromWord);
myThread.Start(); myThread.Start();
myThread.Join(30000); // Wait 30 seconds to time-out myThread.Join(30000); // Wait 30 seconds to time-out
@ -306,13 +306,13 @@ namespace DataLoader
sw.Close(); sw.Close();
} }
} }
private int SaveWordDoc(string temppath, string stype, string sectName) private int SaveWordDoc(string temppath, string stype, string sectName, bool isLandscape)
{ {
ConfigInfo ci = new ConfigInfo(null); ConfigInfo ci = new ConfigInfo(null);
ci.AddItem("Edit", "Initialized", "true"); ci.AddItem("Edit", "Initialized", "true");
FileInfo myFile = new FileInfo(temppath); FileInfo myFile = new FileInfo(temppath);
ci.AddItem("History", "OriginalFileName", myFile.Name); ci.AddItem("History", "OriginalFileName", myFile.Name);
return SaveWordDoc(temppath, String.Empty, stype, ci, sectName, myFile.LastWriteTimeUtc); return SaveWordDoc(temppath, String.Empty, stype, isLandscape, ci, sectName, myFile.LastWriteTimeUtc);
} }
private int SaveTheDoc(string temppath, string title, ConfigInfo ci, string ascii, DateTime dtsutc) private int SaveTheDoc(string temppath, string title, ConfigInfo ci, string ascii, DateTime dtsutc)
{ {