Set grid border based upon type

This commit is contained in:
John Jenko 2011-09-28 13:16:38 +00:00
parent 44ad35500a
commit 37d81afc5b

View File

@ -117,7 +117,8 @@ namespace DataLoader
string fixStpText = ""; string fixStpText = "";
if (IsATable(content.Type)) if (IsATable(content.Type))
{ {
fixStpText = ConvertTableToGrid(stptext, content, fmt, isROTable); bool hasBorder = !WithoutBorder(content.Type);
fixStpText = ConvertTableToGrid(stptext, content, fmt, isROTable, hasBorder ? GridLinePattern.Single : GridLinePattern.None );
int? typ = ConvertTableType(content, fmt); int? typ = ConvertTableType(content, fmt);
if (typ != null) content.Type = typ; if (typ != null) content.Type = typ;
else _ContentMigrationErrors.Add(content.ContentID, null); else _ContentMigrationErrors.Add(content.ContentID, null);
@ -359,7 +360,7 @@ namespace DataLoader
private Regex _RemoveComments = new Regex(@"\\v .*?\\v0( |$)"); private Regex _RemoveComments = new Regex(@"\\v .*?\\v0( |$)");
private string ConvertTableToGrid(string stepText, Content content, FormatInfo fmt, bool isROTable) private string ConvertTableToGrid(string stepText, Content content, FormatInfo fmt, bool isROTable, GridLinePattern border)
{ {
string savethis = stepText; string savethis = stepText;
string strGrid = ""; string strGrid = "";
@ -368,7 +369,7 @@ namespace DataLoader
VE_Font vefont = fmt.PlantFormat.FormatData.StepDataList.Table.Font; VE_Font vefont = fmt.PlantFormat.FormatData.StepDataList.Table.Font;
Font GridFont = new Font(vefont.Family, (float)vefont.Size); Font GridFont = new Font(vefont.Family, (float)vefont.Size);
grd.Font = GridFont; // this also changes the default Row Height "Rows.DefaultSize" grd.Font = GridFont; // this also changes the default Row Height "Rows.DefaultSize"
grd.ParseTableFromText(stepText); grd.ParseTableFromText(stepText,border);
grd.AutoSizeCols(); grd.AutoSizeCols();
grd.AutoSizeRows(); grd.AutoSizeRows();
grd.MakeRTFcells(); grd.MakeRTFcells();
@ -398,6 +399,18 @@ namespace DataLoader
} }
return rtnval; return rtnval;
} }
private bool WithoutBorder(int? contenttype)
{
bool rtnval = false;
switch (contenttype)
{
case 20033: // AER table without boarder
case 20034: // Centered table without boarder
rtnval = true;
break;
}
return rtnval;
}
//private static bool AddContentDetail(Content content, int type, string strn) //private static bool AddContentDetail(Content content, int type, string strn)
//{ //{