Hello,
I'm doing some experiments with WordsProcessing and found an annoying problem.
In a docx document, I have a table in the header. The table height is 2.48cm.
In a test application, I've just opened the document and save it, using your library.
After that, I've opened the document in Word and the table height is not correct as it is only 1.46cm (that's the height of the text inside the table).
Looking at the in-memory data of the document, the height of the table row is set to "Auto".
Unfortunately, there is also a border on this table and it now looks ugly, not counting that the image in the header "crosses" the table border
I also have the same problem in the footer, that also contains a table. In this part, this is more annoying because the height of the footer is not respected and the whole document formatting is not correct.
Hello,
I have a docx template file that contains both MERGEFIELD and CheckBox.
Using version 2021.1.118 of Telerik.Windows.Documents.Flow I perform MailMerge on that document.
After mailmerge the Checkbox control in the output document looses its style when being manually triggered. Manually triggering checkbox in original template does not change original style.
It's expected, that after mailmerge the Checkbox behaves as before mailmerge.
The complete demo is here:
https://github.com/vslynko/telerik-mailmerge-bugreport
While evaluating Telerik.Documents.Spreadsheet.Trial (2021.1.118) I've encountered a bug with registering custom functions in .NET 5.
I'm using a console application, and trying to register a couple of functions right at the start of the Main() method. It works like a charm with target framework netcoreapp3.1.
But as soon as I bump the version to net5.0, registering a function throws an exception (I've copied the full stack below).
Perhaps you can guide me what happens? We're currently evaluating on upgrading our license for the latest features, but this thing could be crucial to us, since we need to use .NET 5 for a couple of reasons.
I'm calling them right at the start of the applicaption
public
static
void
Main(
string
[] args)
{
FunctionManager.RegisterFunction(
new
AAA());
FunctionManager.RegisterFunction(
new
BBB());
...
}
Here's the exception stack:
Unhandled exception. System.TypeInitializationException: The type initializer for 'Telerik.Windows.Documents.Spreadsheet.Expressions.Functions.FunctionManager' threw an exception.
---> System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation.
---> System.TypeInitializationException: The type initializer for 'Telerik.Windows.Documents.Spreadsheet.Expressions.Functions.Db' threw an exception.
---> System.ArgumentOutOfRangeException: Index and count must refer to a location within the string. (Parameter 'count')
at System.String.Remove(Int32 startIndex, Int32 count)
at Telerik.Windows.Documents.Spreadsheet.Formatting.FormatHelper.FindAllOccurrences(String value, String part)
at Telerik.Windows.Documents.Spreadsheet.Formatting.FormatHelper.ReplaceSeparators(String formatString, Predicate`1 shouldReplaceWithGroupSeparator, Predicate`1 shouldReplaceWithDecimalSeparator, String newGroupSeparat
or, String newDecimalSeparator)
at Telerik.Windows.Documents.Spreadsheet.Formatting.FormatHelper.ReplaceCultureSpecificSeparatorsWithDefaults(String formatString, Nullable`1 formatStringCategory)
at Telerik.Windows.Documents.Spreadsheet.Model.CellValueFormat..ctor(String formatString, Boolean convertToInvariant, Nullable`1 formatStringCategory)
at Telerik.Windows.Documents.Spreadsheet.Model.CellValueFormat..ctor(String formatString)
at Telerik.Windows.Documents.Spreadsheet.Expressions.Functions.Db..cctor()
--- End of inner exception stack trace ---
at Telerik.Windows.Documents.Spreadsheet.Expressions.Functions.Db..ctor()
--- End of inner exception stack trace ---
at System.RuntimeTypeHandle.CreateInstance(RuntimeType type, Boolean publicOnly, Boolean wrapExceptions, Boolean& canBeCached, RuntimeMethodHandleInternal& ctor, Boolean& hasNoDefaultCtor)
at System.RuntimeType.CreateInstanceDefaultCtorSlow(Boolean publicOnly, Boolean wrapExceptions, Boolean fillCache)
at System.RuntimeType.CreateInstanceDefaultCtor(Boolean publicOnly, Boolean skipCheckThis, Boolean fillCache, Boolean wrapExceptions)
at System.Activator.CreateInstance(Type type, Boolean nonPublic, Boolean wrapExceptions)
at System.Activator.CreateInstance(Type type)
at Telerik.Windows.Documents.Spreadsheet.Expressions.Functions.FunctionManager..cctor()
--- End of inner exception stack trace ---
at Telerik.Windows.Documents.Spreadsheet.Expressions.Functions.FunctionManager.RegisterFunction(FunctionBase function)
at Iface.Oik.ScriptEngine.Program.Main(String[] args) in C:\Users\alexeid\Rider\Iface.Oik.ScriptEngine\src\Program.cs:line 20
How do I get (or "read") a table cell's text value?
For example:
var row = table.Rows[i];
int nbCols = row.Cells.Count();
if (!(nbCols < 1))
{
for (int j = 1; j < nbCols; j++)
{
Run run = new Run(row.Cells[j].Blocks[0].Document);
if (run.Text == "«Signature»")
{
RadFlowDocumentEditor colEditor = new RadFlowDocumentEditor(row.Cells[j].Blocks[0].Document);
// if it's the Signature cell then replace the content of the cell by the Image ...
// How do I do this ??
}
}
}
In the code above I am trying to iterate through the collection of columns to find the one that contains text «Signature» so that I can replace that text with an image. The beast I could do is use the run as shown above but it never finds the value (although the value is in the table).
Thanks
Hi,
I would like to export some excel files in a zip without writing on disk.
I have seen ZipLibrary example and I would like to adapt it with excel (if possible).
The idea is to do something like this in "OnClick" event for exemple (see code bellow)
Thanks in advance for your help
using
(MemoryStream stream =
new
MemoryStream())
{
using
(ZipArchive archive =
new
ZipArchive(stream, ZipArchiveMode.Create, leaveOpen:
true
, entryNameEncoding:
null
))
{
//I don't need TXT but just for testing ...
using
(ZipArchiveEntry entry = archive.CreateEntry(
"text1.txt"
))
{
StreamWriter writer =
new
StreamWriter(entry.Open());
writer.WriteLine(
"Hello world!"
);
writer.Flush();
}
//Adding excel file
using
(ZipArchiveEntry entry = archive.CreateEntry(
"testxlsx.xlsx"
))
{
//How to handle / edit XLSX file here ?
}
}
Response.Clear();
Response.AddHeader(
"content-disposition"
,
"attachment; filename=zipfile.zip"
);
Response.ContentType =
"application/zip"
;
Response.BinaryWrite(stream.ToArray());
Response.End();
}
Do you have any sample code to set a form field with an image so that the image is centered in the form field but keeps it's aspect ratio without going outside the bounding box? Does the image need to be resized first to reduce filesize?
Thanks.
I am placing a image in a table cell and below the image I will be adding 1 to 3 lines of text. I have it all working, but have 2 questions.
1. I would like to center the image vertically in the table cell.
2. I want to single space the inserted text (paragraph)
Below is my code:
using (Stream firstImage = File.OpenRead(outputFileName))
{
var inImage = table1.Rows[x].Cells[y].Blocks.AddParagraph().Inlines.AddImageInline();
inImage.Image.Size = new System.Windows.Size(colWidth, colWidth);
inImage.Image.LockAspectRatio = true;
inImage.Image.ImageSource = new Telerik.Windows.Documents.Media.ImageSource(firstImage, "jpg");
}
table1.Rows[x].Cells[y].Blocks.AddParagraph().Inlines.AddRun(Path.GetFileNameWithoutExtension(h.fileName)); // filename
Hello,
I'm trying to work with Telerik PDF-Processing right now. But an issue appeared, that I have no clue how to solve.
In this current project, time is a very important aspect, so it's necessary for me to save milliseconds everywhere i can. So I logged the time for all of the Processes and, I don't know why, the first time, i use the methods, it needs more time, than the other later runs.
Here's a simple example out of this project:
private List<RadFixedPage> GetAllAddingPages(List<string> pathList)
{
List<RadFixedPage> AllPages = new List<RadFixedPage>();
for (int i = 1; i < pathList.Count; i++)
{
RadFixedPage read = provider.Import(File.ReadAllBytes(pathList[i])).Pages[0];
AllPages.Add(read);
}
return AllPages;
}
The method's supposed to read the first pages of every document, that is filled in the "PathList."
I've stopped the first run and it needed about 150-160ms to execute. The second run is all about 20ms. There are only 3 Files that've been loaded.
So i tested more..
If i only load a document, that has no Image inside, it needs about the same time on the first run. If afterwards a document is loaded with only an Image, it needs long time also (103ms). If I open 3 documents (Vectorgraphics, Images and Text) it needs the 150-160ms.
Is this a known issue, or can somebody maybe help me with this?
This is only one example, where this problem appears. But if there is a solution for this one, i can maybe apply it to the other methods.
Best regards
Jakob