Example #1
0
 /// <summary>
 ///Lock cell cua hoc sinh mien giam
 /// </summary>
 public void LockCellExemptType(IVTWorksheet workSheet, int row1, int col1, int row2, int col2)
 {
     NativeExcel.IWorksheet templateSheet = workSheet.Worksheet;
     NativeExcel.IRange     usedRang      = templateSheet.Range[row1, col1, row2, col2];
     usedRang.Locked           = true;
     usedRang.EntireRow.Locked = true;
 }
Example #2
0
        public IVTWorksheet CopySheetToBefore(IVTWorksheet worksheet, int index)
        {
            NativeExcel.IWorksheet sheet   = Workbook.Worksheets.AddBefore(index);
            IVTWorksheet           vtSheet = new VTWorksheet(sheet);

            vtSheet.CopySheet(worksheet);
            return(vtSheet);
        }
Example #3
0
        public IVTWorksheet CopySheetToBefore(IVTRange worksheetRange, int index, string sheetname = "")
        {
            NativeExcel.IWorksheet sheet   = Workbook.Worksheets.AddBefore(index);
            IVTWorksheet           vtSheet = new VTWorksheet(sheet);

            vtSheet.CopyPasteSameSize(worksheetRange, 1, 1);
            vtSheet.Name = sheetname;
            return(vtSheet);
        }
Example #4
0
        public IVTWorksheet CopySheetToBeforeLast(IVTWorksheet worksheet)
        {
            NativeExcel.IWorksheet templateSheet = worksheet.Worksheet;
            NativeExcel.IWorksheet sheet         = Workbook.Worksheets.AddBefore(Workbook.Worksheets.Count);
            IVTWorksheet           vtSheet       = new VTWorksheet(sheet);

            vtSheet.CopySheet(worksheet);
            return(vtSheet);
        }
Example #5
0
 public void Lock(IVTWorksheet workSheet, int row1, int col1, int row2, int col2)
 {
     NativeExcel.IWorksheet templateSheet = workSheet.Worksheet;
     NativeExcel.IRange     usedRang      = templateSheet.Range[row1, col1, row2, col2];
     usedRang.Locked         = true;
     usedRang.Font.Color     = System.Drawing.Color.Black;
     usedRang.Interior.Color = System.Drawing.Color.Yellow;
     //usedRang.Font.Strikethrough = true;
 }
Example #6
0
        public void CopySheet(IVTWorksheet worksheet, string lastCell)
        {
            NativeExcel.IWorksheet templateSheet = worksheet.Worksheet;
            NativeExcel.IRange     usedRang      = templateSheet.UsedRange;
            IVTRange vtRange = worksheet.GetRange("A1", lastCell);

            CopyPasteSameSize(vtRange, 1, 1);
            CopyPageSetup(templateSheet);
        }
Example #7
0
        public void CopySheet(IVTWorksheet worksheet)
        {
            NativeExcel.IWorksheet templateSheet = worksheet.Worksheet;
            NativeExcel.IRange     usedRang      = templateSheet.UsedRange;
            IVTRange vtRange = worksheet.GetRange(1, 1, usedRang.Rows.Count + usedRang.Row - 1, usedRang.Columns.Count + 1);

            CopyPasteSameSize(vtRange, 1, 1);
            CopyPageSetup(templateSheet);
        }
Example #8
0
        public IVTWorksheet CopySheetToLast(IVTWorksheet worksheet, string lastCell = null)
        {
            NativeExcel.IWorksheet templateSheet = worksheet.Worksheet;
            NativeExcel.IWorksheet sheet         = Workbook.Worksheets.AddAfter(Workbook.Worksheets.Count);

            IVTWorksheet vtSheet = new VTWorksheet(sheet);

            if (lastCell == null)
            {
                vtSheet.CopySheet(worksheet);
            }
            else
            {
                vtSheet.CopySheet(worksheet, lastCell);
            }
            return(vtSheet);
        }
Example #9
0
 private void CopyPageSetup(NativeExcel.IWorksheet templateSheet)
 {
     Worksheet.PageSetup.Orientation       = templateSheet.PageSetup.Orientation;
     Worksheet.PageSetup.HeaderMargin      = templateSheet.PageSetup.HeaderMargin;
     Worksheet.PageSetup.FooterMargin      = templateSheet.PageSetup.FooterMargin;
     Worksheet.PageSetup.BottomMargin      = templateSheet.PageSetup.BottomMargin;
     Worksheet.PageSetup.TopMargin         = templateSheet.PageSetup.TopMargin;
     Worksheet.PageSetup.LeftMargin        = templateSheet.PageSetup.LeftMargin;
     Worksheet.PageSetup.RightMargin       = templateSheet.PageSetup.RightMargin;
     Worksheet.PageSetup.PaperSize         = templateSheet.PageSetup.PaperSize;
     Worksheet.PageSetup.Zoom              = templateSheet.PageSetup.Zoom;
     Worksheet.PageSetup.PrintTitleColumns = templateSheet.PageSetup.PrintTitleColumns;
     Worksheet.PageSetup.PrintTitleRows    = templateSheet.PageSetup.PrintTitleRows;
     Worksheet.FreezePanes         = templateSheet.FreezePanes;
     Worksheet.ScrollRow           = templateSheet.ScrollRow;
     Worksheet.ScrollColumn        = templateSheet.ScrollColumn;
     Worksheet.SplitRow            = templateSheet.SplitRow;
     Worksheet.SplitColumn         = templateSheet.SplitColumn;
     Worksheet.Split               = templateSheet.Split;
     Worksheet.PageSetup.PrintArea = templateSheet.PageSetup.PrintArea;
 }
Example #10
0
        public IVTWorksheet CopySheetToLastClearColor(IVTWorksheet worksheet, string lastCell = null, object Color = null)
        {
            NativeExcel.IWorksheet templateSheet = worksheet.Worksheet;
            NativeExcel.IWorksheet sheet         = Workbook.Worksheets.AddAfter(Workbook.Worksheets.Count);

            if (Color != null)
            {
                sheet.Cells.Interior.Color = (Color)Color;
            }

            IVTWorksheet vtSheet = new VTWorksheet(sheet);

            if (lastCell == null)
            {
                vtSheet.CopySheet(worksheet);
            }
            else
            {
                vtSheet.CopySheet(worksheet, lastCell);
            }
            return(vtSheet);
        }
Example #11
0
 public VTWorksheet(NativeExcel.IWorksheet worksheet)
 {
     Worksheet = worksheet;
 }