Hi,
I have a situation where I need to send a fairly large amount of data via zip files by email.
The company server limits emails to 4 mg in size, so I can't send one big zip file that, for example, might be 10mg.
I need to:
1. create a zip file
2. add a file to it
3. test how big the zip file is.
4. if it's larger than 4 mg, back out the file I just added use the< 4mg file to attach to the email.
5. Lather, rinse, repeat until all files have been sent.
How do I tell what the current size of the zip file will be after adding a file to it but before I close the archive?
01.MailMessage mail;02.long currentZipSize = 0;03.int attIdx = 0;04.// Get the selected attachments05.var q = from a in db.Attachments06. where rptParms.AttachmentIds.Contains(a.AttachmentId)07. select a;08.List<Models.Attachment> lstSel = q.ToList();09.int i;10.mail = new MailMessage();11.using (MemoryStream ms = new MemoryStream())12.{13.using (ZipArchive zArchive = new ZipArchive(ms, ZipArchiveMode.Create, true))14.{15. var lrEntry = zArchive.CreateEntry("LabReport.pdf", CompressionLevel.Fastest);16. using (BinaryWriter bw = new BinaryWriter(lrEntry.Open()))17. {18. bw.Write(result.DocumentBytes, 0, result.DocumentBytes.Length);19. bw.Flush();20. }21. currentZipSize = zArchive.GetSize; // ************* how do I get this size?22. Models.Attachment att1;23. 24. // Add them to teh zip25. for(i = attIdx; i < lstSel.Count; i++)26. {27. att1 = lstSel[i];28. ZipArchiveEntry zEntry = zArchive.CreateEntry(att1.FileName, CompressionLevel.Fastest);29. using (var f = File.Open(att1.FullPathDecorated, FileMode.Open))30. {31. using (Stream entryStream = zEntry.Open())32. {33. f.CopyTo(entryStream);34.// ************* how do I get this size? when I run this I get an error35.// ************* 36. currentZipSize += zEntry.CompressedLength;37. }38. // if the size is too big for the mail server back out the last file 39. if (currentZipSize > 4000000)40. {41. currentZipSize -= zEntry.CompressedLength;42. zArchive.GetEntry(att1.FileName).Delete();43. 44. ms.Seek(currentZipSize, SeekOrigin.Begin);45. SendMail(mail, rptParms, ms, zArchive, af.CustomKey, emailCnt++);46. currentZipSize = 0;47. attIdx--;48. }49. else50. attIdx++;51. }52. }53. 54. 55.}56.//byte[] buf = ms.GetBuffer();57.//Buffer.BlockCopy(buf, numberOfBytesToRemove, buf, 0, (int)ms.Length - numberOfBytesToRemove);58.//ms.SetLength(ms.Length - numberOfBytesToRemove);59.//ms.Seek(0, SeekOrigin.Begin);60.//System.Net.Mail.Attachment oAttach = new System.Net.Mail.Attachment(ms, "LabReport.zip");61.//mail.Attachments.Add(oAttach);62.//SmtpClient client = new SmtpClient();63.//client.Host = "intermail.basf-corp.com";64.//client.Send(mail);65.//client.Dispose();66.//mail.Dispose();67.Utilities.SetStatusBarText(EventAggregator, "Report Sent.");68.}

Hello,
I want to protect some Paragraphs in a document against changing. But it seems not to be possible.
I have tried:
document.ProtectionSettings.Enforce = true;
document.ProtectionSettings.ProtectionMode = DocumentProtectionMode.ReadOnly;
But it ist still possible to Change the document in word.
Thanks in advance
Holger

I'm struggling to see how to programmatically keep track of the relevant Y position to give to the FixedContentEditor after adding dynamically created elements such as tables and Text that can vary in height.
An example would be Drawing a Block that contains text from a SQL Query. This text could be one line long or 30 lines long and therefore the height of the text can vary greatly (below its in dtJobHeader.Rows(0).Item("Comment")). I need to be able to tell the editor.position.translate where it needs to move to and draw the next block after the previous block is drawn.
editor.Position.Translate(defaultLeftIndent, currentTopOffset)
editor.DrawBlock(DrawBlock(dtJobHeader.Rows(0).Item("Comment")), New Size(maxWidth, Double.PositiveInfinity))
currentTopOffset += ????
editor.Position.Translate(defaultLeftIndent, currentTopOffset)
editor.DrawBlock(DrawBlock("Some Text Here, etc, etc, etc"), New Size(maxWidth, Double.PositiveInfinity))
Private Function DrawBlock(texttodraw As String) As Block
Dim block As New Block()
block.GraphicProperties.FillColor = RgbColors.Black
block.HorizontalAlignment = HorizontalAlignment.Left
block.TextProperties.Font = FontsRepository.Helvetica
block.InsertText(texttodraw)
Return block
End Function

Hi,
Is it possible to do the DOCX to PDF conversion? Because I have a document in a folder and I want to export to pdf.
How to align content in cell vertically?
cell.VerticalAlignment = Telerik.Windows.Documents.Flow.Model.Styles.VerticalAlignment.Center;
does not help me. Text is still align at top
cell = row.Cells.AddTableCell();cell.VerticalAlignment = Telerik.Windows.Documents.Flow.Model.Styles.VerticalAlignment.Center;cell.PreferredWidth = new TableWidthUnit(TableWidthUnitType.Percent, 15);paragraph = cell.Blocks.AddParagraph();run = paragraph.Inlines.AddRun();run.Text = "Text in cell text in cell text in cell";
I'm trying to create a table and add strings to the cells in a RadFixedDocument as per the c# example here:
http://docs.telerik.com/devtools/document-processing/libraries/radpdfprocessing/editing/table.html
table table = new Table();
TableRow row = table.Rows.AddTableRow();
row.Cells.AddTableCell().Blocks.AddBlock().InsertText("First cell");
row.Cells.AddTableCell().Blocks.AddBlock().InsertText("Second cell");
When I convert this to vb.net using your tool I get this:
Dim table As Telerik.Windows.Documents.Flow.Model.Table
Dim row As Telerik.Windows.Documents.Flow.Model.TableRow = table.Rows.AddTableRow()
row.Cells.AddTableCell().Blocks.AddBlock().InsertText("First cell")
row.Cells.AddTableCell().Blocks.AddBlock().InsertText("Second cell")
and get the following error:
AddBlock is not a member of BlockCollection
Could someone please attached a code snippet or demo showing how to create a PDF containing Tables with values in them but in VB.NET please.
(I am doing this in a AJAX web application Telerik R1 2017)

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
