Beispiel #1
0
            public void PasteIn(Microsoft.Office.Interop.Excel.Range cell)
            {
                cell.ColumnWidth = 17;
                cell.RowHeight   = 33;
                //barcode.Save(path);

                //string datas = BarcodeScanner.ScanOne(path);
                var LinkToFile       = false;
                var saveWithDocument = true;
                var Left             = cell.Left + 2;
                var Top    = cell.Top + 2;
                var Width  = 0;
                var Height = 0;

                Microsoft.Office.Interop.Excel.Shape myShape = Globals.ThisAddIn.Application.ActiveSheet.Shapes.AddPicture(
                    Path,
                    LinkToFile,
                    saveWithDocument,
                    Left,
                    Top,
                    Width,
                    Height);
                ////'--(2) 挿入した画像に対して元画像と同じ高さ・幅にする
                myShape.ScaleHeight(0.6F, Office.MsoTriState.msoTrue);
                myShape.ScaleWidth(0.6F, Office.MsoTriState.msoTrue);

                //File.Delete(path);
            }
Beispiel #2
0
        public void sign()
        {
            SigCtl               sigCtl = new SigCtl();
            DynamicCapture       dc     = new DynamicCapture();
            DynamicCaptureResult res    = dc.Capture(sigCtl, "Name", "Reason", null, null);

            if (res == DynamicCaptureResult.DynCaptOK)
            {
                SigObj sigObj = (SigObj)sigCtl.Signature;
                //sigObj.set_ExtraData("AdditionalData", "C# test: Additional data");

                String filename = System.IO.Path.GetTempFileName();
                try
                {
                    sigObj.RenderBitmap(filename, 400, 200, "image/png", 1.0f, 0x000000, 0xffffff, 5.0f, 5.0f, RBFlags.RenderOutputFilename | RBFlags.RenderColor32BPP | RBFlags.RenderEncodeData | RBFlags.RenderBackgroundTransparent);

                    Range activecell = Globals.ThisAddIn.Application.Selection;

                    Worksheet ws = Globals.ThisAddIn.Application.ActiveSheet;

                    Microsoft.Office.Interop.Excel.Shape signature =
                        ws.Shapes.AddPicture(filename, Office.MsoTriState.msoFalse, Office.MsoTriState.msoTrue, activecell.Left, activecell.Top, 400, 200);

                    signature.Placement = XlPlacement.xlMoveAndSize;
                    signature.Height    = (float)activecell.Height;
                    signature.Width     = (float)activecell.Width;
                }
                catch (Exception ex)
                {
                    MessageBox.Show(ex.Message);
                }
            }
        }