Hi,
I do HtmlFormatProvider.Import (html), in html have Images, there is an exception (ParamName: data)
(Telerik ASP.NET AJAX 2015.1.104.45)
Why?
I was curious to know the process for simply freezing a specified set of rows at the top.
For example, we have a title section which takes up 7 rows, with each set of cells in a row merged to the number of columns. The variable colSpan would be the number of header columns in the spreadsheet.
worksheet.MergeCells(0, 0, 0, colSpan - 1); // first title segment
worksheet.MergeCells(1, 0, 1, colSpan - 1); // second title segment
...
I simply want to be able to freeze those top rows and be able to scroll both vertically and horizontally through the data below the frozen rows.
using (IWorksheetViewExporter worksheetView = worksheet.CreateWorksheetViewExporter())
{
worksheetView.SetFreezePanes(8, colSpan);
}
However, when I use the freeze panes method, you can scroll vertically through all the content, but the horizontal scrolling starts in the cell at the bottom right of the last title row. How can I achieve horizontal scrolling beginning at the first row and first cell of the rows below the title rows?
Thank you.
HI,
We used IWorksheetExporter (Telerik.Documents.SpreadsheetStreaming library) to create Excel file. But did not find any method to create Header and Footer. Does anyone know how to do it? Thanks.
Hello,
When attempting to export a manually created workbook I obtain this error message:
Value cannot be null.
Parameter name: workbook at Telerik.Windows.Documents.Spreadsheet.FormatProviders.OpenXml.Xlsx.Utilities.XlsxHelper.ConvertColumnPixelWidthToExcelWidth(Workbook workbook, Double columnWidthInPixels)
at Telerik.Windows.Documents.Spreadsheet.FormatProviders.OpenXml.Xlsx.Contexts.XlsxWorksheetExportContext..ctor(XlsxWorkbookExportContext workbookContext, Worksheet worksheet, Int32 sheetNo)
at Telerik.Windows.Documents.Spreadsheet.FormatProviders.OpenXml.Xlsx.Contexts.XlsxWorkbookExportContext.InitializeWorksheetContexts()
at Telerik.Windows.Documents.Spreadsheet.FormatProviders.OpenXml.Xlsx.Contexts.XlsxWorkbookExportContext.Initialize()
at Telerik.Windows.Documents.Spreadsheet.FormatProviders.OpenXml.Xlsx.XlsxFormatProvider.ExportOverride(Workbook workbook, Stream output)
at [Redacted] Controller.cs:line 203
I Generate the workbook using this method:
public Workbook WriteExcelFile(List<Object> list)
{
Workbook workbook = new Workbook();
using (Worksheet worksheet = workbook.Worksheets.Add())
{
CellRange range = new CellRange(1, 1, list.Count, 5);
CellSelection selection = worksheet.Cells[range];
if (selection.CanInsertOrRemove(range, ShiftType.Right))
{
selection.Insert(InsertShiftType.Right);
}
for (int row = 0; row < list.Count; row++)
{
worksheet.Cells[row, 0].SetValue(list[row].string1);
worksheet.Cells[row, 1].SetValue(list[row].string2);
worksheet.Cells[row, 2].SetValue(list[row].string3);
worksheet.Cells[row, 3].SetValue(list[row].string4);
worksheet.Cells[row, 4].SetValue(list[row].string5);
}
}
return workbook;
}
The attempt to write it to a memory stream (FileStream was also attempted)
using (Stream output = new MemoryStream(10000))
formatProvider.Export(workbook, output);
Could you help me understand the reason behind this error?
I would like to be able to read a PDF document and import the contents of tables within the PDF document. Do you have an examples that shows how I would:
I'm just trying to create a table in PDF with this:
https://docs.telerik.com/devtools/document-processing/libraries/radpdfprocessing/editing/table
In general a nice thing.
1) The only way to set the Font of the (entire) table I found, is to set the Font for each singular block in each singular cell, and this before inserting the text.
That means I cannot just do this: AddTableCell().Blocks.AddBlock().InsertText("cell11");
Is there a simpler way, to have some Default for the entire Table ? I found this DefaultCellProperties thing, but this concerns only background and borders
2) There is this property
table.LayoutType = Telerik.Windows.Documents.Fixed.Model.Editing.Flow.TableLayoutType.FixedWidth;
The automatic works quiet well if you have text in the table, having f.e. an empty line, it shrinks the height of this line.
So I thought I changed to 'fixedwidth' and set it manually.
But than, I haven't found anything to set width oder height of Rows or Cells.
So what is this FixedWidth good for, how do I set the height of a Row or a ColumnWidth, although the concept of a column is kind of missing in this class.
Fails to open simple excel
var assembly = Assembly.GetEntryAssembly();
var resourceStream = assembly.GetManifestResourceStream("Dispatcher.Resources.someexcel.xlsx");
resourceStream.Position = 0;
XlsxFormatProvider formatProvider = new XlsxFormatProvider();
Workbook workbook = formatProvider.Import(resourceStream);
I cannot attach excel file here
stack trace
System.NullReferenceException: Object reference not set to an instance of an object.
at Telerik.Windows.Documents.Spreadsheet.FormatProviders.OpenXml.Xlsx.Model.Elements.Worksheets.DataValidationElement.CopyPropertiesToSingleArgumentContext(SingleArgumentDataValidationRuleContext context)
at Telerik.Windows.Documents.Spreadsheet.FormatProviders.OpenXml.Xlsx.Model.Elements.Worksheets.DataValidationElement.CopyPropertiesToDataValidationRuleContext(DataValidationRuleContextBase context)
at Telerik.Windows.Documents.Spreadsheet.FormatProviders.OpenXml.Xlsx.Model.Elements.Worksheets.DataValidationElement.ListRuleFactory(IXlsxWorksheetImportContext context)
at Telerik.Windows.Documents.Spreadsheet.FormatProviders.OpenXml.Xlsx.Model.Elements.Worksheets.DataValidationElement.OnAfterRead(IXlsxWorksheetImportContext context)
at Telerik.Windows.Documents.Spreadsheet.FormatProviders.OpenXml.Xlsx.Model.Elements.Worksheets.WorksheetElementBase.OnAfterRead(IXlsxWorkbookImportContext context)
at Telerik.Windows.Documents.FormatProviders.OpenXml.Model.Elements.OpenXmlElementBase`3.OnAfterRead(IOpenXmlImportContext context)
at Telerik.Windows.Documents.FormatProviders.OpenXml.Model.Elements.OpenXmlElementBase.Read(IOpenXmlReader reader, IOpenXmlImportContext context)
at Telerik.Windows.Documents.FormatProviders.OpenXml.Model.Elements.OpenXmlElementBase.ReadChildElements(IOpenXmlReader reader, IOpenXmlImportContext context)
at Telerik.Windows.Documents.FormatProviders.OpenXml.Model.Elements.OpenXmlElementBase.Read(IOpenXmlReader reader, IOpenXmlImportContext context)
at Telerik.Windows.Documents.FormatProviders.OpenXml.Model.Elements.OpenXmlElementBase.ReadChildElements(IOpenXmlReader reader, IOpenXmlImportContext context)
at Telerik.Windows.Documents.FormatProviders.OpenXml.Model.Elements.OpenXmlElementBase.Read(IOpenXmlReader reader, IOpenXmlImportContext context)
at Telerik.Windows.Documents.FormatProviders.OpenXml.Model.Parts.OpenXmlPartBase.Import(IOpenXmlReader reader, IOpenXmlImportContext context)
at Telerik.Windows.Documents.FormatProviders.OpenXml.OpenXmlImporter`1.ImportXlsxPartFromArchive(ZipArchiveEntry zipEntry, OpenXmlPartBase part, IOpenXmlImportContext context)
at Telerik.Windows.Documents.FormatProviders.OpenXml.OpenXmlImporter`1.Import(Stream input, IOpenXmlImportContext context)
at Telerik.Windows.Documents.Spreadsheet.FormatProviders.OpenXml.Xlsx.XlsxFormatProvider.ImportOverride(Stream input)
at Telerik.Windows.Documents.Spreadsheet.FormatProviders.WorkbookFormatProviderBase.Import(Stream input)
at Dispatcher.Controllers.ClientsController.<GenerateAccurals>d__9.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at lambda_method(Closure , Object )
at Microsoft.Extensions.Internal.ObjectMethodExecutorAwaitable.Awaiter.GetResult()
at Microsoft.AspNetCore.Mvc.Internal.ControllerActionInvoker.<InvokeActionMethodAsync>d__12.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at Microsoft.AspNetCore.Mvc.Internal.ControllerActionInvoker.<InvokeNextActionFilterAsync>d__10.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at Microsoft.AspNetCore.Mvc.Internal.ControllerActionInvoker.Rethrow(ActionExecutedContext context)
at Microsoft.AspNetCore.Mvc.Internal.ControllerActionInvoker.Next(State& next, Scope& scope, Object& state, Boolean& isCompleted)
at Microsoft.AspNetCore.Mvc.Internal.ControllerActionInvoker.<InvokeInnerFilterAsync>d__14.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at Microsoft.AspNetCore.Mvc.Internal.ResourceInvoker.<InvokeNextResourceFilter>d__22.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at Microsoft.AspNetCore.Mvc.Internal.ResourceInvoker.Rethrow(ResourceExecutedContext context)
at Microsoft.AspNetCore.Mvc.Internal.ResourceInvoker.Next(State& next, Scope& scope, Object& state, Boolean& isCompleted)
at Microsoft.AspNetCore.Mvc.Internal.ResourceInvoker.<InvokeFilterPipelineAsync>d__17.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at Microsoft.AspNetCore.Mvc.Internal.ResourceInvoker.<InvokeAsync>d__15.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at Microsoft.AspNetCore.Builder.RouterMiddleware.<Invoke>d__4.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at Microsoft.AspNetCore.Builder.RouterMiddleware.<Invoke>d__4.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at Microsoft.AspNetCore.Localization.RequestLocalizationMiddleware.<Invoke>d__4.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.ValidateEnd(Task task)
at Microsoft.AspNetCore.Authentication.AuthenticationMiddleware.<Invoke>d__6.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at Microsoft.AspNetCore.Diagnostics.EntityFrameworkCore.MigrationsEndPointMiddleware.<Invoke>d__4.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at Microsoft.AspNetCore.Diagnostics.EntityFrameworkCore.DatabaseErrorPageMiddleware.<Invoke>d__6.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at Microsoft.AspNetCore.Diagnostics.EntityFrameworkCore.DatabaseErrorPageMiddleware.<Invoke>d__6.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at Microsoft.AspNetCore.Diagnostics.DeveloperExceptionPageMiddleware.<Invoke>d__7.MoveNext()
Exception thrown: 'System.NullReferenceException' in Telerik.Windows.Documents.Spreadsheet.FormatProviders.OpenXml.dll
Object reference not set to an instance of an object.
Hi
I coding below . I can convert file but document file inside textbox , these textbox can't convert to pdf file and document file inside picture alignment fix positing on page but can't convert to pdf file. I am using below code and I got empty page after convert pdf file. Because my doc file inside picture and textbox.
I try other document file include pic (in line with text ) and not include textbox. These file can get correct format with pdf file.
My Coding.....
Dim fileFormatProvider As IFormatProvider(Of Flow.Model.RadFlowDocument) = New Flow.FormatProviders.Docx.DocxFormatProvider()
Dim documentToConvert As Flow.Model.RadFlowDocument = New Flow.Model.RadFlowDocument()
Using input As FileStream = New FileStream("H:\\Files\\Testing.docx", FileMode.Open)
documentToConvert = fileFormatProvider.Import(input)
End Using
fileFormatProvider = New Telerik.Windows.Documents.Flow.FormatProviders.Pdf.PdfFormatProvider()
Using output As Stream = New FileStream(pathpdf, FileMode.OpenOrCreate)
fileFormatProvider.Export(documentToConvert, output)
End Using
Thanks
Moe
var providerDocx =
new
DocxFormatProvider();
var document = providerDocx.Import(inStream);
//inStream is read from a docx file earlier
var providerPdf =
new
PdfFormatProvider();
Stream outStream =
new
MemoryStream();
providerPdf.Export(document, outStream);
//Test the conversion:
var fileStream = File.Create(
"PdfTest.pdf"
);
outStream.Seek(0, SeekOrigin.Begin);
outStream.CopyTo(fileStream);
fileStream.Close();
Hello, I had an application that used the excel interop, but I have changed it and now, to create the excels I use telerik, but some of my clients that use Excel 2003 have problems to open the excel created, they appear rare characters. Any ideas please? My code is something like that
string
nombre= ruta +
"\\excel.xls"
;
Workbook workbook =
new
Workbook();
workbook.Sheets.Add(SheetType.Worksheet);
Worksheet xlsSheet = xlsBook.ActiveWorksheet;
xlsSheet.Cells[1, 1].SetValue(
"prueba"
);
...
...
//Guardamos y abrimos la excel.
IWorkbookFormatProvider formatProvider = WorkbookFormatProvidersManager.GetProviderByName(
"XlsxFormatProvider"
);
using
(Stream output =
new
FileStream(nombre, FileMode.Create))
{
formatProvider.Export(workbook, output);
}
Thank you!