public static void Run()
        {
            //Source directory
            string sourceDir = RunExamples.Get_SourceDirectory();

            //Output directory
            string outputDir = RunExamples.Get_OutputDirectory();

            // Create a workbook and opening a template spreadsheet
            Workbook workbook = new Workbook(sourceDir + "sampleErrorCheckingOptions.xlsx");

            // Get the first worksheet
            Worksheet sheet = workbook.Worksheets[0];

            // Instantiate the error checking options
            ErrorCheckOptionCollection opts = sheet.ErrorCheckOptions;

            int index            = opts.Add();
            ErrorCheckOption opt = opts[index];

            // Disable the numbers stored as text option
            opt.SetErrorCheck(ErrorCheckType.TextNumber, false);

            // Set the range
            CellArea ca = CellArea.CreateCellArea("A1", "E20");

            opt.AddRange(ca);

            // Save the Excel file
            workbook.Save(outputDir + "outputErrorCheckingOptions.xlsx");

            Console.WriteLine("ErrorCheckingOptions executed successfully.\r\n");
        }
        public static void Main()
        {
            //ExStart:1
            // The path to the documents directory.
            string dataDir = Aspose.Cells.Examples.Utils.GetDataDir(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);

            //Create a workbook and opening a template spreadsheet
            Workbook workbook = new Workbook(dataDir + "Book1.xlsx");

            //Get the first worksheet
            Worksheet sheet = workbook.Worksheets[0];
            //Instantiate the error checking options
            ErrorCheckOptionCollection opts = sheet.ErrorCheckOptions;

            int index            = opts.Add();
            ErrorCheckOption opt = opts[index];

            //Disable the numbers stored as text option
            opt.SetErrorCheck(ErrorCheckType.TextNumber, false);
            //Set the range
            opt.AddRange(CellArea.CreateCellArea(0, 0, 1000, 50));

            //Save the Excel file
            workbook.Save(dataDir + "out_test.out.xlsx");
            //ExEnd:1
        }
Example #3
0
        private static void RemoveSuperfluousErrorWarnings(Worksheet sheet)
        {
            ErrorCheckOptionCollection opts = sheet.ErrorCheckOptions;
            int index            = opts.Add();
            ErrorCheckOption opt = opts[index];

            opt.SetErrorCheck(ErrorCheckType.TextDate, false);
            opt.SetErrorCheck(ErrorCheckType.TextNumber, false);
            opt.AddRange(CellArea.CreateCellArea(0, 0, sheet.Cells.MaxRow + 1, sheet.Cells.MaxColumn + 1));
        }
Example #4
0
        public static void Main()
        {
            // The path to the documents directory.
            string dataDir = Path.GetFullPath("../../../Data/");

            //Create a workbook and opening a template spreadsheet
            Workbook workbook = new Workbook(dataDir + "Book1.xlsx");

            //Get the first worksheet
            Worksheet sheet = workbook.Worksheets[0];
            //Instantiate the error checking options
            ErrorCheckOptionCollection opts = sheet.ErrorCheckOptions;

            int index            = opts.Add();
            ErrorCheckOption opt = opts[index];

            //Disable the numbers stored as text option
            opt.SetErrorCheck(ErrorCheckType.TextNumber, false);
            //Set the range
            opt.AddRange(CellArea.CreateCellArea(0, 0, 1000, 50));

            //Save the Excel file
            workbook.Save(dataDir + "out_test.xlsx");
        }