public void TestSyncAllFontStyle() { Microsoft.Office.Interop.PowerPoint.Shape formatShape = GetShape(OriginalShapesSlideNo, CopyFromSmallShape); Microsoft.Office.Interop.PowerPoint.Shape newShape = GetShape(OriginalShapesSlideNo, CopyToShape); FontStyleFormat.SyncFormat(formatShape, newShape); CheckFontStyle(OriginalShapesSlideNo, SyncAllFontStyleSlideNo); }
public void TestSyncAllFontStyle() { var formatShape = GetShape(OriginalShapesSlideNo, CopyFromSmallShape); var newShape = GetShape(OriginalShapesSlideNo, CopyToShape); FontStyleFormat.SyncFormat(formatShape, newShape); CheckFontStyle(OriginalShapesSlideNo, SyncAllFontStyleSlideNo); }
public override bool Equals(object obj) { FontStyleFormat ffs = obj as FontStyleFormat; if (ffs == null) { return(false); } return(this.Bold == ffs.bold && this.Size == ffs.size && this.FontName.CompareTo(ffs.fontName) == 0 && this.Italic == ffs.italic && this.Underline == ffs.underline); }
private FontStyle FontStyleConvertTo(FontStyleFormat source) { if (source == FontStyleFormat.Normal) { return(FontStyles.Normal); } else if (source == FontStyleFormat.Italic) { return(FontStyles.Italic); } return(FontStyles.Normal); }
private static int SetFontFormat(bool bold, int size, string fontName, bool italic, bool underline) { FontStyleFormat currentFont = new FontStyleFormat(bold, size, fontName, italic, underline); int fontCounter = 1; foreach (FontStyleFormat f in fontStyleFormatList) { if (currentFont.Equals(f)) { return(fontCounter); } fontCounter++; } fontStyleFormatList.Add(currentFont); return(fontStyleFormatList.Count); }
public FontViewModel(C1FlexSheet flex, IEnumerable <CellRange> cellRange) { _flex = flex; _cellRange = cellRange; foreach (var font in Fonts.SystemFontFamilies) { if (FontsCollection == null) { FontsCollection = new ObservableCollection <FontFamily>(); } FontsCollection.Add(font); } if (FontsStyles == null) { FontsStyles = new ObservableCollection <FontStyleFormat>() { FontStyleFormat.Normal, FontStyleFormat.Italic, FontStyleFormat.Bold } } ; if (FontSize == null) { FontSize = new ObservableCollection <double>(); } int from = 8; int to = 72; for (; from <= to;) { FontSize.Add(from); if (from < 12) { from++; } else { from = from + 2; } } if (Underlines == null) { Underlines = new ObservableCollection <UnderLines>() { UnderLines.None, UnderLines.Underline } } ; var cell = cellRange.FirstOrDefault(); var row = _flex.Rows[cell.TopRow] as ExcelRow; if (row != null && cell.IsValid) { var col = _flex.Columns[cell.Column]; var cs = row.GetCellStyle(col); cs = cs ?? new CellStyle(); _origionFont = SelectedFont = cs.FontFamily ?? new FontFamily("Arial"); _origionFontSize = SelectedFontSize = cs.FontSize ?? 11; SelectedFontStyle = FontStyleConvertFrom(cs.FontStyle, cs.FontWeight); _origionFontStyle = SelectedFontStyle; if (cs.TextDecorations == null || cs.TextDecorations.Count == 0) { SelectedUnderLine = UnderLines.None; } else { SelectedUnderLine = UnderLinesConvertFrom(cs.TextDecorations); } _origionUnderline = SelectedUnderLine; var brush = (SolidColorBrush)cs.Foreground; _origionColor = SelectedColor = brush == null ? Colors.Transparent : brush.Color; } }