internal void MarkStyleAsExported(int styleIndex, int result, ushort type) { ExportCacheCellStyle style = this[styleIndex]; style.AddExportedType(type, result); styles[styleIndex] = style; }
public bool IsEqual(ExportCacheCellStyle style) { return(style.BkColor == BkColor && style.FgColor == FgColor && style.TextColor == TextColor && TextFont.Equals(style.TextFont) && style.BrushStyle_ == BrushStyle_ && LeftBorder.IsEqual(style.LeftBorder) && TopBorder.IsEqual(style.TopBorder) && RightBorder.IsEqual(style.RightBorder) && BottomBorder.IsEqual(style.BottomBorder) && (style.TextAlignment == TextAlignment) && (style.LineAlignment == LineAlignment) && (style.FormatString == FormatString) && (style.Url == Url)); }
private string GetBorderStyle(ExportCacheCellStyle style) { string result = ""; result += "<border_left" + GetBorderStyleContent(style.LeftBorder) + "/>\n"; result += "<border_up" + GetBorderStyleContent(style.TopBorder) + "/>\n"; result += "<border_right" + GetBorderStyleContent(style.RightBorder) + "/>\n"; result += "<border_down" + GetBorderStyleContent(style.BottomBorder) + "/>"; return(result); }
private string GetStyle(ExportCacheCellStyle style) { string result = ""; result += " border-style: solid;"; result += " padding: 3;"; if (style.LeftBorder.Width == style.TopBorder.Width && style.LeftBorder.Width == style.RightBorder.Width && style.LeftBorder.Width == style.BottomBorder.Width) { result += " border-width: " + Convert.ToString(style.LeftBorder.Width) + ";"; } else { result += " border-left-width: " + Convert.ToString(style.LeftBorder.Width) + ";"; result += " border-top-width: " + Convert.ToString(style.TopBorder.Width) + ";"; result += " border-right-width: " + Convert.ToString(style.RightBorder.Width) + ";"; result += " border-bottom-width: " + Convert.ToString(style.BottomBorder.Width) + ";"; } if (style.LeftBorder.Color_ == style.TopBorder.Color_ && style.LeftBorder.Color_ == style.RightBorder.Color_ && style.LeftBorder.Color_ == style.BottomBorder.Color_) { result += " border-color: " + GetHtmlColor(style.LeftBorder.Color_) + ";"; } else { result += " border-left-color: " + GetHtmlColor(style.LeftBorder.Color_) + ";"; result += " border-top-color: " + GetHtmlColor(style.TopBorder.Color_) + ";"; result += " border-right-color: " + GetHtmlColor(style.RightBorder.Color_) + ";"; result += " border-bottom-color: " + GetHtmlColor(style.BottomBorder.Color_) + ";"; } result += " font-family: \"" + style.TextFont.Name + "\";"; if (style.TextFont.Bold) { result += " font-weight: bold;"; } if (style.TextFont.Italic) { result += " font-style: italic;"; } if (style.TextFont.Underline) { result += " text-decoration: underline;"; } if (style.TextFont.Strikeout) { result += " text-decoration: line-through;"; } result += " font-size: " + Convert.ToString(style.TextFont.Size) + "pt;"; result += " color: " + GetHtmlColor(style.TextColor) + ";"; result += " background-color: " + GetHtmlColor(style.BkColor); return(result); }
private string GetStyle(ExportCacheCellStyle style) { string result = ""; result += "aligntext=\"" + GetAlignText(style.TextAlignment) + "\""; result += " fontname=\"" + style.TextFont.Name + "\""; result += GetFontStyles(style.TextFont); result += " fontcolor=\"" + GetHtmlColor(style.TextColor) + "\""; result += " fontsize=\"" + Convert.ToString(style.TextFont.Size) + "\""; result += " bkcolor=\"" + GetHtmlColor(style.BkColor) + "\""; return(result); }
public int RegisterStyle(ExportCacheCellStyle style) { for (int i = 0; i < Count; i++) { if (this[i].IsEqual(style)) { return(i); } } styles.Add(style); return(styles.Count - 1); }
private string GetCellParams(int col, int row) { string result = ""; int width = GetCellWidth(col, row); if (width > 0) { result += " width=\"" + Convert.ToString(width) + "\""; } ExportCacheCellStyle style = GetCellStyle(col, row); result += " align=\""; switch (style.TextAlignment) { case StringAlignment.Near: result += "left\""; break; case StringAlignment.Center: result += "center\""; break; case StringAlignment.Far: result += "right\""; break; } ; if (cache[col, row].IsUnion) { if (cache[col, row].UnionWidth > 1) { result += " colspan=\"" + Convert.ToString(cache[col, row].UnionWidth) + "\""; } if (cache[col, row].UnionHeight > 1) { result += " rowspan=\"" + Convert.ToString(cache[col, row].UnionHeight) + "\""; } } result += " styleclass=\"" + Convert.ToString(cache[col, row].StyleIndex) + "\""; return(result); }
private ExportCacheCellStyle CreateDefaultStyle() { ExportCacheCellStyle result = new ExportCacheCellStyle(); result.TextColor = SystemColors.WindowText; result.TextAlignment = StringAlignment.Near; result.LineAlignment = StringAlignment.Near; result.TextFont = new Font("Tahoma", 8); result.BkColor = SystemColors.Window; result.FgColor = Color.Black; result.BrushStyle_ = BrushStyle.Solid; result.LeftBorder.Color_ = SystemColors.ActiveBorder; result.TopBorder.Color_ = SystemColors.ActiveBorder; result.RightBorder.Color_ = SystemColors.ActiveBorder; result.BottomBorder.Color_ = SystemColors.ActiveBorder; result.LeftBorder.Width = 1; result.TopBorder.Width = 1; result.RightBorder.Width = 1; result.BottomBorder.Width = 1; return(result); }
void InternalSetRange(int width, int height, bool isVisible) { if (width <= 0 || height <= 0) { throw new ExportCacheException(rangeError); } cache = new ExportCacheItem[width, height]; columns = new int[width]; rows = new int[height]; for (int i = 0; i < width; i++) { columns[i] = 0; for (int j = 0; j < height; j++) { cache[i, j].Data = null; cache[i, j].InternalCache = null; cache[i, j].IsHidden = false; cache[i, j].IsUnion = false; cache[i, j].UnionHeight = 1; cache[i, j].UnionWidth = 1; cache[i, j].StyleIndex = 0; } } for (int i = 0; i < height; i++) { rows[i] = 0; } ExportCacheCellStyle defaultStyle = styleManager.DefaultStyle; int defaultBorderWidth = 0; if (isVisible) { defaultBorderWidth = 1; } defaultStyle.LeftBorder.Width = defaultBorderWidth; defaultStyle.TopBorder.Width = defaultBorderWidth; defaultStyle.RightBorder.Width = defaultBorderWidth; defaultStyle.BottomBorder.Width = defaultBorderWidth; SetDefaultStyle(defaultStyle); }
public override void CommitCache(StreamWriter writer) { OnProviderProgress(0); writer.WriteLine("<table border=\"1\" cellspacing=\"0\"" + " cellpadding=\"0\">"); for (int i = 0; i < CacheHeight(); i++) { writer.WriteLine("<tr>"); for (int j = 0; j < CacheWidth(); j++) { if (cache[j, i].IsHidden) { continue; } if (cache[j, i].IsUnion) { writer.Write("<td"); if (cache[j, i].UnionWidth > 1) { writer.Write(" colspan=\"" + Convert.ToString(cache[j, i].UnionWidth) + "\""); } if (cache[j, i].UnionHeight > 1) { writer.Write(" rowspan=\"" + Convert.ToString(cache[j, i].UnionHeight) + "\""); } } else { writer.Write("<td"); } int cellWidth = GetCellWidth(j, i); if (cellWidth > 0) { writer.Write(" width=\"" + Convert.ToString(cellWidth) + "\""); } ExportCacheCellStyle style = GetCellStyle(j, i); writer.Write(" align=\""); switch (style.TextAlignment) { case StringAlignment.Near: writer.Write("left"); break; case StringAlignment.Center: writer.Write("center"); break; case StringAlignment.Far: writer.Write("right"); break; } writer.Write("\""); writer.Write(" nowrap"); writer.Write(" class=\"style" + Convert.ToString(cache[j, i].StyleIndex) + "\">"); string displayValue = ""; if (cache[j, i].InternalCache != null) { cache[j, i].InternalCache.CommitCache(writer); } else { if (cache[j, i].Data == null) { displayValue = ""; } else { switch (cache[j, i].DataType) { case ExportCacheDataType.String: displayValue = ConvertSpecialSymbols((string)cache[j, i].Data); break; case ExportCacheDataType.Integer: displayValue = Convert.ToString((int)cache[j, i].Data); break; case ExportCacheDataType.Single: displayValue = Convert.ToString((float)cache[j, i].Data); break; case ExportCacheDataType.Double: displayValue = Convert.ToString((double)cache[j, i].Data); break; case ExportCacheDataType.Boolean: displayValue = Convert.ToString((bool)cache[j, i].Data); break; case ExportCacheDataType.Decimal: displayValue = Convert.ToString((decimal)cache[j, i].Data); break; default: displayValue = Convert.ToString(cache[j, i].Data); break; } displayValue = ConvertCRLFSymbols(displayValue); } if (IsEmptyString(displayValue)) { displayValue += " "; } } writer.WriteLine(displayValue + "</td>"); } writer.WriteLine("</tr>"); if (CacheHeight() > 1) { OnProviderProgress(i * 100 / (CacheHeight() - 1)); } } writer.WriteLine("</table>"); OnProviderProgress(100); }
public void SetCellStyleAndUnion(int col, int row, int width, int height, ExportCacheCellStyle style) { SetCellUnion(col, row, width, height); SetCellStyle(col, row, style); }
public void SetCellStyle(int col, int row, ExportCacheCellStyle style) { TestIndex(col, row); cache[col, row].StyleIndex = styleManager.RegisterStyle(style); }
public void SetStyle(ExportCacheCellStyle style) { int styleIndex = styleManager.RegisterStyle(style); SetStyle(styleIndex); }
public void SetDefaultStyle(ExportCacheCellStyle style) { styleManager.DefaultStyle = style; }
public int RegisterStyle(ExportCacheCellStyle style) { return(styleManager.RegisterStyle(style)); }