public Dictionary <StylePropertyName, object> GetDefaultStyleInfos(ICellInfo cellInfo)
        {
            var styles = new Dictionary <StylePropertyName, object>();

            //默认情况下LayDateCellType右对齐
            styles.Add(StylePropertyName.HorizontalAlignment, ForguncyCellHorizontalAlignment.Right);
            return(styles);
        }
 private void SetAddress(ExcelWorksheet ws, ExcelAddressBase address)
 {
     _ws      = ws;
     _fromRow = address._fromRow;
     _fromCol = address._fromCol;
     _toRow   = address._toRow;
     _toCol   = address._toCol;
     _address = address;
     _values  = new CellStoreEnumerator <ExcelValue>(_ws._values, _fromRow, _fromCol, _toRow, _toCol);
     _cell    = new CellInfo(_ws, _values);
 }
 public RangeInfo(ExcelWorksheet ws, int fromRow, int fromCol, int toRow, int toCol)
 {
     _ws = ws;
     _fromRow = fromRow;
     _fromCol = fromCol;
     _toRow = toRow;
     _toCol = toCol;
     _address = new ExcelAddressBase(_fromRow, _fromCol, _toRow, _toCol);
     _address._ws = ws.Name;
     _values = new CellsStoreEnumerator<object>(ws._values, _fromRow, _fromCol, _toRow, _toCol);
     _cell = new CellInfo(_ws, _values);
 }
 public RangeInfo(ExcelWorksheet ws, ExcelAddressBase address)
 {
     _ws          = ws;
     _fromRow     = address._fromRow;
     _fromCol     = address._fromCol;
     _toRow       = address._toRow;
     _toCol       = address._toCol;
     _address     = address;
     _address._ws = ws.Name;
     _values      = new CellsStoreEnumerator <ExcelCoreValue>(ws._values, _fromRow, _fromCol, _toRow, _toCol);
     _cell        = new CellInfo(_ws, _values);
 }
Exemple #5
0
 public RangeInfo(ExcelWorksheet ws, ExcelAddress address)
 {
     _ws          = ws;
     _fromRow     = address._fromRow;
     _fromCol     = address._fromCol;
     _toRow       = address._toRow;
     _toCol       = address._toCol;
     _address     = address;
     _address._ws = ws.Name;
     _values      = ws._values.GetEnumerator(_fromRow, _fromCol, _toRow, _toCol);
     _cell        = new CellInfo(_ws, _values);
 }
Exemple #6
0
 public RangeInfo(ExcelWorksheet ws, int fromRow, int fromCol, int toRow, int toCol)
 {
     _ws          = ws;
     _fromRow     = fromRow;
     _fromCol     = fromCol;
     _toRow       = toRow;
     _toCol       = toCol;
     _address     = new ExcelAddress(_fromRow, _fromCol, _toRow, _toCol);
     _address._ws = ws.Name;
     _values      = ws._values.GetEnumerator(_fromRow, _fromCol, _toRow, _toCol);
     _cell        = new CellInfo(_ws, _values);
 }
        public override FrameworkElement GetDrawingControl(ICellInfo cellInfo, IDrawingHelper drawingHelper)
        {
            Grid  grid  = new Grid();
            Image image = new Image();

            image.Source              = new BitmapImage(new Uri("pack://application:,,,/BDMapCellType;component/Resources/Preview.png", UriKind.RelativeOrAbsolute));
            image.Stretch             = Stretch.Uniform;
            image.VerticalAlignment   = VerticalAlignment.Center;
            image.HorizontalAlignment = HorizontalAlignment.Center;

            grid.Children.Add(image);
            return(grid);
        }
        public ExportResultInfo ExportToExcel(ICellInfo targetCell, IExportContext context)
        {
            var value = targetCell.Value as string;

            if (string.IsNullOrEmpty(value))
            {
                return(null);
            }
            var byteArray         = Convert.FromBase64String(value.Substring(context.ExportImageContext.BASE64STRINGHEAD.Length));
            var bitmapImageSource = context.GetPictureByByteArray(byteArray, context.PictureSize.Width, context.PictureSize.Height);

            return(new ExportResultInfo()
            {
                ExportValue = null,
                ExportPicture = bitmapImageSource
            });
        }
        public override FrameworkElement GetDrawingControl(ICellInfo cellInfo, IDrawingHelper drawingHelper)
        {
            StackPanel stackPanel = new StackPanel();

            TextBlock textBlock = new TextBlock();

            textBlock.Text                = "Sign Here...";
            textBlock.FontFamily          = new System.Windows.Media.FontFamily("Comic Sans MS");
            textBlock.FontSize            = 16;
            textBlock.HorizontalAlignment = HorizontalAlignment.Center;
            textBlock.VerticalAlignment   = VerticalAlignment.Center;
            if (!object.Equals(cellInfo.Foreground, null))
            {
                textBlock.Foreground = cellInfo.Foreground;
            }

            stackPanel.Children.Add(textBlock);
            stackPanel.VerticalAlignment = VerticalAlignment.Center;

            return(stackPanel);
        }
 public RangeInfo(ExcelWorksheet ws, ExcelAddressBase address)
 {
     _ws = ws;
     _fromRow = address._fromRow;
     _fromCol = address._fromCol;
     _toRow = address._toRow;
     _toCol = address._toCol;
     _address = address;
     _address._ws = ws.Name;
     _values = new CellsStoreEnumerator<ExcelCoreValue>(ws._values, _fromRow, _fromCol, _toRow, _toCol);
     _cell = new CellInfo(_ws, _values);
 }