The dynamic Word documents was created in ASP.net and stream it through System.IO.MemoryStream.
I read the stream data from System.IO.MemoryStream and put it in a Zip file using Telerik Zip Archive Entry,
But the error of "The destination file could not be create" keeps popping out...please see my code below and
let me know what I missed....Please help me....thanks.
oResponse.Clear()
oResponse.AddHeader("content-disposition", "attachment; filename=Gerrytest4.zip")
oResponse.ContentType = "application/octet-stream"
Using memoryStream As New System.IO.MemoryStream
Using archive As New ZipArchive(memoryStream, ZipArchiveMode.Create, True, Nothing)
Using entry As ZipArchiveEntry = archive.CreateEntry(sSSPFilename)
Dim writer As New BinaryWriter(entry.Open())
oDocTemplate.Save(memoryStream, oFormat)
Dim sr As BinaryReader = New BinaryReader(memoryStream, System.Text.Encoding.UTF8)
memoryStream.Position = 0
writer.Write(sr.ReadBytes(memoryStream.Length))
writer.Flush()
End Using
End Using
oResponse.BinaryWrite(memoryStream.ToArray())
End Using
Hi Guys.
Im using the following to extract files to a new directory under windows 10.
Users do not have Admin rights
Dim NewDir As String = GetGUID
System.IO.Directory.CreateDirectory(My.Computer.FileSystem.CombinePath(VADataCacheClass.VaTempStorage, NewDir))
If System.IO.Directory.Exists(My.Computer.FileSystem.CombinePath(VADataCacheClass.VaTempStorage, NewDir)) Then
Try
Telerik.WinControls.Zip.Extensions.ZipFile.ExtractToDirectory(ZipFile, My.Computer.FileSystem.CombinePath(VADataCacheClass.VaTempStorage, NewDir))
For Each f As String In My.Computer.FileSystem.GetFiles(My.Computer.FileSystem.CombinePath(VADataCacheClass.VaTempStorage, NewDir))
ImportCollection.Add(f)
Next
Catch ex As Exception
MessageBox.Show(ex.ToString)
End Try
For Each f As String In My.Computer.FileSystem.GetFiles(My.Computer.FileSystem.CombinePath(VADataCacheClass.VaTempStorage, NewDir))
ImportCollection.Add(f)
Next
End If
Unfortunately the zip extract method always fails with an "Access denied" error message.
However the "for loop" which is designed to add the files extracted to a string collection has no problem reading any files in the directory
Is the some sort of write permission setting im missing in the Telerik.WinControls.Zip.Extensions.ZipFile.ExtractToDirectory method
Hello,
I'm creating a PDF document using the FixedContentEditor class. In this document, I've to put a lot of tables and I use the Measure() function to read the height of the last table inserted in order to move the current position (with editor.Position.Translate) and to start with a new table.
Unfortunately, I noticed that this works fine but if the table has multi rows texts in cells, the Measure function gives me the result as the cells had only singles row texts in the cells.
To add a cell with multi rows text I use the following code:
TableRow row = table.Rows.AddTableRow();
TableCell cell = row.Cells.AddTableCell();
Block block = cell.Blocks.AddBlock();
block.InsertText(font, FontStyles.Normal, FontWeights.Bold,
"Details:"
);
cell = row.Cells.AddTableCell();
block = cell.Blocks.AddBlock();
foreach
(
string
line
in
multirows_text.Split(
'\n'
))
{
block.InsertText(fontFamily, fontStyle, fontWeight, line);
block.InsertLineBreak();
}
Then, I use the following code to get the table height:
table.Measure().Height
that gives me the same value both if the multirows_text string variable contains one or more lines of text
Is there another way to get the table height in case of tables with multiple lines of text cells?
Any help will be appreciated. Thanks in advance.
Giorgio
When I am trying to merge cells in a spreadsheet I get the error "The given key was not present in the dictionary.", I am able to merge cells accross columns on the same row using MergeAccross but I am unable to merge cells in the same column over multiple rows. I am not sure if this is a bug or if it just something I am doing. Any help would be appreciated.
For d As Integer = 0 To arrDate.GetUpperBound(0)
fromCellIndex = New CellIndex(5, d + 1)
toCellIndex = New CellIndex(10, d + 1)
xlWorkSheet.Cells(fromCellIndex, toCellIndex).Clear(ClearType.All)
nCellSelection = xlWorkSheet.Cells(fromCellIndex, toCellIndex)
nCellSelection.Merge() <-- Line the error gets thrown.
next d
Hi,
I'm trying to insert a bullet list in a RadFixedPage using the FixedContentEditor object.
I understood how to do using the RadFixecDocumentEditor object. Please find a very small example here below:
List list = editor.Lists.AddList(ListTemplateType.BulletDefault);
editor.ParagraphProperties.ListId = list.Id;
editor.ParagraphProperties.ListLevel = 0;
editor.InsertParagraph();
editor.InsertLine("Item 1");
editor.InsertParagraph();
editor.InsertLine("Item 2");
editor.InsertParagraph();
...
But I tried in all ways that I could but I didn't understand in the documentation how to do the same using the FixedContentEditor class.
Could you please give me a short example that shows how to insert a List in a RadFixedPage using the FixedContentEditor class?
Thanks in advance
Giorgio
Hi, I wonder if you can help with my issue
I have a problem when I try to convert a docx to pdf. The error I get is the following: The type initializer for 'Telerik.Windows.Documents.Fixed.Model.FixedDocumentDefaults' threw an exception
I use the following code:
byte[] renderedBytes2 = null;
Telerik.Windows.Documents.Common.FormatProviders.IFormatProvider<RadFlowDocument> formatProvider2 = new Telerik.Windows.Documents.Flow.FormatProviders.Pdf.PdfFormatProvider();
using (MemoryStream memoria2 = new MemoryStream())
{
formatProvider2.Export(document, memoria2);
renderedBytes2 = memoria2.ToArray();
//string nombre = "EstudioBNF.pdf";
GuardarHistoria(nombrepdf, memoria2);
}
The things to note are:
* No exception is thrown when the project is run from Visual Studio..
*The exception is thrown at runtime
I am trying to export a number of images (up to several hundreds) into a PDF file (client-side in Silverlight). Here is a sample code that simulates this task:
// controlToExport is a control on the screen
RadBitmap bitmap =
new
RadBitmap(controlToExport);
for
(
int
i = 0; i < 50; i++)
{
var page =
this
.document.Pages.AddPage();
page.Content.AddImage(
new
Telerik.Windows.Documents.Fixed.Model.Resources.ImageSource(bitmap.Bitmap));
}
// stream is User's file
var exportProvider =
new
Telerik.Windows.Documents.Fixed.FormatProviders.Pdf.PdfFormatProvider();
exportProvider.Export(
this
.document, stream);
This works but the export consumes ~500MB of memory while busy, which causes out-of-memory exceptions on lower end machines. How can I minimize the memory consumption.
In the real scenario, the loop will create many different images and will add them to the document instead of adding same image many times.
Hi,
I want to enumerate and modify mergefields manually in a table, because Telerik is currently not supported nested mail merge (ref: https://feedback.telerik.com/Project/184/Feedback/Details/190035-wordsprocessing-nested-mail-merge)
I found some code snippets similar to code below, but i can't find the FieldRangeStart type in the Word Processing Libraries for ASP.NET Ajax, seems it's works only WPF libraries? Isn't it?
foreach
(FieldRangeStart fieldStart
in
document.EnumerateChildrenOfType<FieldRangeStart>())
{
if
(fieldStart.Field
is
MergeField)
{
mergeFields.Add(fieldStart);
}
}
What do you suggest for enumerate and modify merge fields manually?