public static void Run() { //Source directory string sourceDir = RunExamples.Get_SourceDirectory(); //Output directory string outputDir = RunExamples.Get_OutputDirectory(); // Open a template Excel file Workbook workbook = new Workbook(sourceDir + "sampleGetIconSetsDataBars.xlsx"); // Get the first worksheet in the workbook Worksheet sheet = workbook.Worksheets[0]; // Get the A1 cell Cell cell = sheet.Cells["A1"]; // Get the conditional formatting result object ConditionalFormattingResult cfr = cell.GetConditionalFormattingResult(); // Get the icon set ConditionalFormattingIcon icon = cfr.ConditionalFormattingIcon; // Create the image file based on the icon's image data File.WriteAllBytes(outputDir + "outputGetIconSetsDataBars.jpg", icon.ImageData); Console.WriteLine("GetIconSetsDataBars executed successfully.\r\n"); }
public static void Run() { // ExStart:1 // The path to the documents directory. string dataDir = RunExamples.GetDataDir(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType); // Instantiate a workbook object // Open the template file Workbook workbook = new Workbook(dataDir + "Book1.xlsx"); // Get the first worksheet Worksheet worksheet = workbook.Worksheets[0]; // Get the A1 cell Cell a1 = worksheet.Cells["A1"]; // Get the conditional formatting resultant object ConditionalFormattingResult cfr1 = a1.GetConditionalFormattingResult(); // Get the ColorScale resultant color object Color c = cfr1.ColorScaleResult; // Read the color Console.WriteLine(c.ToArgb().ToString()); Console.WriteLine(c.Name); // ExEnd:1 }
public static void Main() { // The path to the documents directory. string dataDir = Path.GetFullPath("../../../Data/"); //Open a template Excel file Workbook workbook = new Workbook(dataDir + "book1.xlsx"); //Get the first worksheet in the workbook Worksheet sheet = workbook.Worksheets[0]; //Get the A1 cell Cell cell = sheet.Cells["A1"]; //Get the conditional formatting result object ConditionalFormattingResult cfr = cell.GetConditionalFormattingResult(); //Get the icon set ConditionalFormattingIcon icon = cfr.ConditionalFormattingIcon; //Create the image file based on the icon's image data File.WriteAllBytes(dataDir + "imgIcon.jpg", icon.ImageData); }
public static void Run() { // ExStart:1 // The path to the documents directory. string dataDir = RunExamples.GetDataDir(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType); // Open a template Excel file Workbook workbook = new Workbook(dataDir + "book1.xlsx"); // Get the first worksheet in the workbook Worksheet sheet = workbook.Worksheets[0]; // Get the A1 cell Cell cell = sheet.Cells["A1"]; // Get the conditional formatting result object ConditionalFormattingResult cfr = cell.GetConditionalFormattingResult(); // Get the icon set ConditionalFormattingIcon icon = cfr.ConditionalFormattingIcon; // Create the image file based on the icon's image data File.WriteAllBytes(dataDir + "imgIcon.out.jpg", icon.ImageData); // ExEnd:1 }