This commit is contained in:
Kathy Ruffing 2008-11-19 13:53:59 +00:00
parent f4daddd0d4
commit dd571890fc
5 changed files with 49 additions and 19 deletions

View File

@ -26,9 +26,9 @@ namespace DataLoader
{
public partial class Loader
{
private void SaveSectionDocument(string fname, string stpseq, ref int cid)
private void SaveSectionDocument(string fname, string stpseq, string stype, ref int cid)
{
int docid = SaveWordDoc(fname);
int docid = SaveWordDoc(fname, stype);
switch (docid)
{
case 0:
@ -44,7 +44,8 @@ namespace DataLoader
break;
}
}
private int SaveWordDoc(string fname, string title, ConfigInfo ci)
private int SaveWordDoc(string fname, string title, string stype, ConfigInfo ci)
{
int docid = 0;
if (System.IO.File.Exists(fname))
@ -52,6 +53,31 @@ namespace DataLoader
if (frmMain.cbSaveDocChecked)
{
WordDoc d = new WordDoc(fname);
/* 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
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();
string s = d.Save(temppath);
d.Close();
@ -69,9 +95,9 @@ namespace DataLoader
log.ErrorFormat("Missing rtf file: {0}", fname);
return docid;
}
private int SaveWordDoc(string temppath)
private int SaveWordDoc(string temppath, string stype)
{
return SaveWordDoc(temppath, String.Empty, null);
return SaveWordDoc(temppath, String.Empty, stype, null);
}
private int SaveTheDoc(string temppath, string title, ConfigInfo ci)
{

View File

@ -71,7 +71,7 @@ namespace DataLoader
string title = null; // for docname, remove the '.lib', i.e. substring(0,8)
DateTime dts = DateTime.Now;
string tmpRtfFileName = GetLibDocData(fi, ci, ref title);
int Docid = SaveWordDoc(tmpRtfFileName, title, ci);
int Docid = SaveWordDoc(tmpRtfFileName, title, null, ci);
File.Delete(tmpRtfFileName);
return Docid;
}

View File

@ -70,7 +70,7 @@ namespace DataLoader
string thenum = num.ToString("d2");
fname = string.Format("{0}\\rtffiles\\{1}.A{2}", pth, ProcFileName, thenum);
Application.DoEvents();
SaveSectionDocument(fname, stpseq, ref Documentid);
SaveSectionDocument(fname, stpseq, SecType, ref Documentid);
if (Documentid == 0)
{
if (MissingDocument==null) MissingDocument = Document.MakeDocument("MISSING FILE IN CONVERSION", null, null, null);
@ -330,8 +330,10 @@ namespace DataLoader
DateTime dts = GetDTS(dr["Date"].ToString(), dr["Time"].ToString());
ConfigInfo ci = null;
ConfigInfo ci = new ConfigInfo(null);
ci.AddItem("Section", "OldType", stype);
// for steps sections...
// Step Section Header Format:
// A0 1X2S51 &Y
@ -357,19 +359,16 @@ namespace DataLoader
// set pagination, continuous, separate. If blank, don't create attribute - uses format default.
if (sequence.Substring(4, 1) == "T")
{
if(ci==null) ci = new ConfigInfo(null);
ci.AddItem("Section", "Pagination", "C");
}
else if (sequence.Substring(4, 1) == "S")
{
if (ci == null) ci = new ConfigInfo(null);
ci.AddItem("Section", "Pagination", "S");
}
// Step: linked to enhanced (!exist = N)
if (sequence.Substring(7, 1) == "1")
{
if (ci == null) ci = new ConfigInfo(null);
ci.AddItem("Step", "LnkEnh", "Y");
}
char cbittst = sequence.PadRight(10)[8];
@ -380,14 +379,12 @@ namespace DataLoader
// determine if TOC element (!exist = N)
if ((cbittst & TOC) > 1)
{
if (ci == null) ci = new ConfigInfo(null);
ci.AddItem("Section", "TOC", "Y");
}
// determine if autogenerated section (!exist = N)
if ((cbittst & AUTOGEN) > 1)
{
isautogen = true;
if (ci == null) ci = new ConfigInfo(null);
ci.AddItem("Section", "AutoGen", "Y");
}
}
@ -399,14 +396,12 @@ namespace DataLoader
// Subsection: editable (!exist = Y)
if ((cbittst & EDDATA) > 0)
{
if (ci == null) ci = new ConfigInfo(null);
ci.AddItem("SubSection", "Edit", "N");
}
// Subsection: print section headers (!exist = Y)
if ((cbittst & PH) > 0)
{
if (ci == null) ci = new ConfigInfo(null);
didsub = true;
ci.AddItem("SubSection", "PH", "N");
}
@ -414,13 +409,11 @@ namespace DataLoader
// Subsection: autoindent (!exist = Y)
if ((cbittst & AUTOIND) > 0)
{
if (ci == null) ci = new ConfigInfo(null);
ci.AddItem("SubSection", "AutoIndent", "N");
}
}
if (!didsub && sequence.Substring(4, 1) == "N")
{
if (ci == null) ci = new ConfigInfo(null);
ci.AddItem("SubSection", "PH", "N");
}
}
@ -434,7 +427,6 @@ namespace DataLoader
// || `--- Position within the procedure
// |`----- Acc. page type (A,I, or F)
// `------ Internal section number (starts at A)
if (ci == null) ci = new ConfigInfo(null);
ci.AddItem("Section", "NumPages", sequence.Substring(3, 1));
// see if it's a libdoc too

View File

@ -59,7 +59,8 @@ namespace DataLoader
// Need the content record for the RO & transitions.
//content = Content.MakeContent(null, stptext, 20000 + int.Parse(newstptyp!=null?newstptyp:StepType),null, ManualPagebreak?ci.ToString():null, dts, userid);
content = Content.New(null, stptext, 20000 + int.Parse(newstptyp != null ? newstptyp : StepType), null, ManualPagebreak ? ci.ToString() : null, dts, userid);
// 20000 flags step type item & 1 adjusts for 'base' in format files.
content = Content.New(null, stptext, 20001 + int.Parse(newstptyp != null ? newstptyp : StepType), null, ManualPagebreak ? ci.ToString() : null, dts, userid);
content.MyZContent.OldStepSequence = ProcNumber + "|" + stpseq;
// Before we save it, handle RO & Transitions tokens.

View File

@ -108,5 +108,16 @@ namespace Volian.MSWord
{
m_App.Quit(ref oFalse, ref optional, ref optional);
}
public void SetLineSpacing(float linesPerInch) // if need landscape set too: , bool landscape)
{
Selection sel = m_App.Selection;
sel.WholeStory();
// if need landscape set too: if (landscape) sel.PageSetup.Orientation = WdOrientation.wdOrientLandscape;
sel.ParagraphFormat.SpaceBefore=0;
sel.ParagraphFormat.SpaceAfter = 0;
sel.ParagraphFormat.LineSpacingRule = WdLineSpacing.wdLineSpaceExactly;
sel.ParagraphFormat.LineSpacing = 72/linesPerInch; // 12 ==> 6 Lines per inch
}
}
}