Ejemplo n.º 1
0
        private void cmbSheets_SelectedValueChanged(object sender, EventArgs e)
        {
            int i = Convert.ToInt32(cmbSheets.SelectedValue);

            Office.ExcelSheet sh = OpenedExcelFile.Sheets.FirstOrDefault(a => a.Index == i);
            lblNumberOfColumns.Text = $"Столбцов: {sh.LastCell.Column}";
            lblNumberOfRows.Text    = $"Строк: {sh.LastCell.Row}";
            FillColumnsCombo(sh);
            txtSplitRowBegin.Text = "2";
            txtSplitRowEnd.Text   = sh.LastCell.Row.ToString();
        }
Ejemplo n.º 2
0
        private void FillColumnsCombo()
        {
            if (OpenedExcelFile == null)
            {
                return;
            }
            int i = Convert.ToInt32(cmbSheets.SelectedValue);

            Office.ExcelSheet sh = OpenedExcelFile.Sheets.FirstOrDefault(a => a.Index == i);
            FillColumnsCombo(sh);
        }
Ejemplo n.º 3
0
        private SplitFileParameters GetSplitFileParameters()
        {
            if (this.OpenedExcelFile == null)
            {
                throw new Exception("Файл не загружен");
            }

            Office.ExcelSheet selectedSheet = OpenedExcelFile.Sheets.FirstOrDefault(a => a.Index == Convert.ToInt32(cmbSheets.SelectedValue));
            string            columnSplit   = (chkShowNumbers.Checked) ? Office.ExcelLastCell.GetColumnName(Convert.ToInt32(cmbSplitColumn.Text)) : cmbSplitColumn.Text;
            int rowBegin = Convert.ToInt32(txtSplitRowBegin.Text);
            int rowEnd   = Convert.ToInt32(txtSplitRowEnd.Text);

            if (rowBegin < 1 || rowBegin > selectedSheet.LastCell.Row || rowEnd < rowBegin || rowEnd > selectedSheet.LastCell.Row)
            {
                throw new Exception("Указан неверный диапазон строк");
            }

            return(new Office.SplitFileParameters(OpenedExcelFile.Path, selectedSheet.Index, columnSplit, rowBegin, rowEnd));
        }
Ejemplo n.º 4
0
 private void FillColumnsCombo(Office.ExcelSheet sh)
 {
     cmbSplitColumn.DataSource = sh.LastCell.Columns((chkShowNumbers.Checked) ? Office.ExcelLastCell.ColumnsType.Numeric : Office.ExcelLastCell.ColumnsType.String);
 }