public string GetFrameStyleAsHtml(Frame frame)
{
string style = "";
try
{
if (frame != null)
{
string width = frame.SvgWidth;
if (width != null)
if (width.EndsWith("cm"))
width = width.Replace("cm", "");
else if (width.EndsWith("in"))
width = width.Replace("in", "");
string height = frame.SvgHeight;
if (height != null)
if (height.EndsWith("cm"))
height = height.Replace("cm", "");
else if (height.EndsWith("in"))
height = height.Replace("in", "");
try
{
if (width != null)
{
double wd = Convert.ToDouble(width, System.Globalization.NumberFormatInfo.InvariantInfo);
string wdPx = "";
if (frame.SvgWidth.EndsWith("cm"))
wdPx = SizeConverter.CmToPixelAsString(wd);
else if (frame.SvgWidth.EndsWith("in"))
wdPx = SizeConverter.InchToPixelAsString(wd);
if (wdPx.Length > 0)
style = "width=\""+wdPx+"\" ";
}
if (height != null)
{
double wd = Convert.ToDouble(height, System.Globalization.NumberFormatInfo.InvariantInfo);
string wdPx = "";
if (frame.SvgHeight.EndsWith("cm"))
wdPx = SizeConverter.CmToPixelAsString(wd);
else if (frame.SvgHeight.EndsWith("in"))
wdPx = SizeConverter.InchToPixelAsString(wd);
if (wdPx.Length > 0)
style = "height=\""+wdPx+"\" ";
}
}
catch(Exception ex)
{
if (this.OnWarning != null)
{
AODLWarning warning = new AODLWarning("Exception while trying to build a graphic width & height.: "
+ frame.SvgWidth + "/" + frame.SvgHeight, ex);
//warning.InMethod = AODLException.GetExceptionSourceInfo(new StackFrame(1, true));
//warning.OriginalException = ex;
OnWarning(warning);
}
}
}
}
catch(Exception ex)
{
throw new AODLException("Exception while trying to build a HTML style string from a FrameStyle.", ex);
}
return style;
}