Currently, the numbers in a CSV file are parsed as numbers, and the leading zeros are lost. In MS Excel, leading zeros could be preserved when the values are imported as text using the more sophisticated text import wizard (http://www.upenn.edu/computing/da/bo/webi/qna/iv_csvLeadingZeros.html ). Workaround: The values could be extracted using a third-party (or custom) CSV parser, and inserted manually into the model, using CellSelection.SetValueAsText method (http://docs.telerik.com/devtools/document-processing/libraries/radspreadprocessing/working-with-cells/cell-value-types.html ).
Use the below code snippet to generate XLSX document and export it. You will notice that the export operation is extremely slow:
Stopwatch sw = new Stopwatch();
sw.Start();
IWorkbookFormatProvider formatProvider = new Telerik.Windows.Documents.Spreadsheet.FormatProviders.OpenXml.Xlsx.XlsxFormatProvider();
Workbook workbook = new Workbook();
Worksheet worksheet = workbook.Worksheets.Add();
Worksheet worksheet2 = workbook.Worksheets.Add();
worksheet2.Name ="Days";
List<string> weekdays = new List<string>() { "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday", "Sunday"};
for (int i = 0; i < 7; i++)
{
worksheet2.Cells[0, i].SetValue(weekdays[i]);
}
for (int i = 0; i < 200; i++)
{
for (int j = 0; j < 10; j++)
{
CellIndex cellIndex = new CellIndex(i, j);
CellSelection selection = worksheet.Cells[cellIndex];
selection.SetValue("Wednesday");
var context = new ListDataValidationRuleContext(worksheet, cellIndex)
{
InputMessageTitle = "InputMessageTitle",
InputMessageContent = "InputMessageTitle"
};
context.ErrorStyle = ErrorStyle.Stop;
context.ErrorAlertTitle = "ErrorAlertTitle";
context.ErrorAlertContent = "ErrorAlertContent";
context.InCellDropdown = true;
context.Argument1 = "=Days!A0:A6"; //"Monday, Tuesday, Wednesday, Thursday, Friday, Saturday, Sunday";
ListDataValidationRule rule = new(context);
worksheet.Cells[cellIndex].SetDataValidationRule(rule);
}
}
string outputFile = @"..\..\..\output.xlsx";
File.Delete(outputFile);
using (Stream output = new FileStream(outputFile, FileMode.Create))
{
formatProvider.Export(workbook, output);
}
sw.Stop();
Debug.WriteLine("Export " + sw.ElapsedMilliseconds);
Import an XLSX document and auto-fit the columns. Then, export the document to XLSX format.
Even though a SpreadFixedTextMeasurer is applied and a FontProvider is implemented, the columns are not wide enough to fit the content:
XIRR function returns the internal rate of return for a schedule of cash flows that is not necessarily periodic. To calculate the internal rate of return for a series of periodic cash flows, use the IRR function.
https://support.microsoft.com/en-gb/office/xirr-function-de1242ec-6477-445b-b11b-a303ad9adc9d
The charts have a display blanks as property which is represented by the dispBlanksAs element. The absence of this element sometimes makes drastic difference in the way a chart might look. E.g. the following chart has a gap in its data and depending on what value dispBlanksAs has, it looks very different.
At this point, the formatting can be applied only to the whole cell content.
CellSelection.SetValue method causes memory leak of CellReferenceRangeExpression objects in some cases when cell value is referenced by formulas. The memory leak is small, but the remaining CellReferenceRangeExpression continue to listen to some events, causing performance issues when their number become large - the time to set the value increases with each set.
In WorksheetPageSetup, you can only get the PageSize, but not set it. The only way is through setting a PaperType.
This is because in Telerik.Windows.Documents.Spreadsheet.Model.Printing.SheetPageSetupBase, the only way to set the pageSize property is by setting a PaperType, then it uses PaperTypeConverter.ToSize(PaperType) to convert it to the pageSize. I cannot see any other way to set this to a custom size set by the user.
Please allow custom page sizing by adding a setter for the PageSize if possible. Thank you!
WorksheetPageSetup pageSetup = worksheet.WorksheetPageSetup;
Size pageSize = new Size(50, 80)
pageSetup.PageSize = pageSize; // produces cs0200
pageSetup.PageSize.Width = pageSize.Width; // produces cs1612
pageSetup.PageSize.Height = pageSize.Height; // produces cs1612
Use the code to import a sample txt file containing a "+" sign in a cell value:
Workbook workbook;
Telerik.Windows.Documents.Spreadsheet.FormatProviders.IWorkbookFormatProvider formatProvider = new Telerik.Windows.Documents.Spreadsheet.FormatProviders.TextBased.Txt.TxtFormatProvider();
using (Stream input = new FileStream(@"sample.txt", FileMode.Open))
{
workbook = formatProvider.Import(input);
}
Expected behavior: the file is imported successfully
Actual behavior: an error is thrown
Some of the leftmost borders are omitted when exported to PDF.
ArgumentException at Telerik.Windows.Documents.FormatProviders.OpenXml.Model.Elements.Theme.SystemColorElement.GetColor(IOpenXmlImportContext context)
The problematic value is val="windowText"