Use the following code to create the document:
Workbook workbook = new Workbook();
Worksheet graphWorksheet = workbook.Worksheets.Add();
FloatingChartShape chartShape = new FloatingChartShape(graphWorksheet,
new CellIndex(0, 0),
new CellRange(0, 0, 0, 0), ChartType.Column)
{
Width = 500,
Height = 500,
};
graphWorksheet.Charts.Add(chartShape);
DocumentChart chart = new DocumentChart();
BarSeriesGroup barSeriesGroup = new BarSeriesGroup();
barSeriesGroup.BarDirection = BarDirection.Column;
StringChartData barCategoryData = new StringChartData(new List<string>() { "1.1", "1.2", "1.3", "1.4", "2.1", "3.1", "4.1", "4.2", "4.3" });
IEnumerable<double> percentEvidentList = new List<double>() { Math.Round((double)0.9914 * 100, 4) , Math.Round((double)0.7719 * 100, 4), Math.Round((double)1 * 100, 4) };
NumericChartData barValues = new NumericChartData(percentEvidentList);
BarSeries series = new BarSeries();
series.Categories = barCategoryData;
series.Values = barValues;
ThemableColor themableColor = ThemableColor.FromArgb(255, 125, 0, 125);
series.Fill = new SolidFill(themableColor);
series.Title = new TextTitle("FY 20");
barSeriesGroup.Series.Add(series);
chart.SeriesGroups.Add(barSeriesGroup);
ValueAxis valueAxis = new ValueAxis();
valueAxis.Min = 0;
valueAxis.Max = 100;
valueAxis.NumberFormat = "0%";
CategoryAxis categoryAxis = new CategoryAxis();
chart.PrimaryAxes = new AxisGroup(categoryAxis, valueAxis);
chart.Legend = new Legend();
chart.Legend.Position = LegendPosition.Left;
chartShape.Chart = chart;
valueAxis.NumberFormat = "0%";
string outputFilePath = "SampleFile.xlsx";
File.Delete(outputFilePath);
IWorkbookFormatProvider formatProvider = new Telerik.Windows.Documents.Spreadsheet.FormatProviders.OpenXml.Xlsx.XlsxFormatProvider();
using (Stream output = new FileStream(outputFilePath, FileMode.Create))
{
formatProvider.Export(workbook, output, TimeSpan.FromSeconds(10));
}
Process.Start(new ProcessStartInfo() { FileName = outputFilePath, UseShellExecute = true });
The COUNTA function counts cells containing any type of information, including error values and empty text ("")
https://support.microsoft.com/en-us/office/counta-function-7dc98875-d5c1-46f1-9a82-53f3219e2509
When I need to populate a cell that I find using a DefinedName I should parse RefersTo to get Worksheet name. But DefinedName class contains Scope property which has CurrentWorksheet and Workbook properties (internal). It would be very useful if these properties could be public.
A reference that refers to the same cell or range on multiple sheets. Example: =SUM(Den1:Den31!C10) will sum C10 from all sheets between Den1 and Den3.
When a formula contains new lines, it is parsed incorrectly as follows: - When it is shared formula it breaks the imported expression and replaces it with #NAME? error. - In normal case it simply preserves the formula string converting it to StringExpression. Workaround: Remove the new lines in the formulas. Have in mind that this code will fix the issue only for the second scenario, when the formula is not shared. CellRange usedCellRange = workbook.ActiveWorksheet.UsedCellRange; for (int row = usedCellRange.FromIndex.RowIndex; row < usedCellRange.ToIndex.RowIndex; row++) { for (int column = usedCellRange.FromIndex.ColumnIndex; column < usedCellRange.ToIndex.ColumnIndex; column++) { CellSelection cell = workbook.ActiveWorksheet.Cells[row, column]; ICellValue value = cell.GetValue().Value; if (value.RawValue.Contains("\n")) { cell.SetValue(value.RawValue.Replace('\n', ' ')); } } }
When defaultThemeVersion is missing from the file, some styles are not shown when the document is opened in MS Excel.
WorksheetPageSetup.ScaleFactor is limited in the range 0.5 - 4 due to limitations in the UI implementations, but this is not needed in RadSpreadProcessing alone.
When printing or exporting to PDF, the left border of A1 cell is not printed/rendered.
When there is some long number value in merged cell and this cell is autofit, then in Excel the cell is visualized with "#####" because the column width is not enough. Workaround: As a workaround in some scenarios it is possible to call Merge method after AutoFitWidth method in order get the correct column width.
Define name which we can import looks like this: <definedName name="Test">Sheet1!$A$1</definedName> The case which can not be handled by RadSpreadProcessing looks like this: <definedName name="Test"><![CDATA[Sheet1!$A$1]]></definedName> The CDATA element is used to escape the inner text in order not to be parsed as XML. That means this is а valid case, and RadSpreadProcessing should handle it.
When there is a defined name referring many cells with long values, the Value of the defined name is string which does not contains the values of all the referred cells and ends with "...".
The item is closed as duplicated of https://feedback.telerik.com/Project/184/Feedback/Details/190065-spreadprocessing-implement-right-to-left-direction.