Telerik Forums
Telerik Document Processing Forum
12 answers
1.0K+ views

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

Martin Ivanov
Telerik team
 answered on 31 Mar 2017
1 answer
306 views

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

Martin Ivanov
Telerik team
 answered on 31 Mar 2017
2 answers
160 views

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

 

Tanya
Telerik team
 answered on 30 Mar 2017
2 answers
344 views

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

Giorgio
Top achievements
Rank 1
 answered on 24 Mar 2017
1 answer
278 views

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

Tanya
Telerik team
 answered on 22 Mar 2017
5 answers
910 views

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.

Deyan
Telerik team
 answered on 20 Mar 2017
3 answers
413 views

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?

 

Tanya
Telerik team
 answered on 02 Mar 2017
1 answer
211 views

I am attempting to format the text, according to the attached example, and place keylines of different sizes.  Any help would be appreciated.

 

 

Dim document As New RadFlowDocument()
Dim editor As New RadFlowDocumentEditor(document)
 
'insert logo
editor.InsertBreak(BreakType.LineBreak)
Using fs As New FileStream(System.Web.HttpContext.Current.Server.MapPath("~/Assets/logo.png"), FileMode.Open, FileAccess.Read)
    editor.InsertImageInline(fs, "png")
End Using
editor.InsertBreak(BreakType.LineBreak)
editor.InsertBreak(BreakType.LineBreak)
editor.InsertBreak(BreakType.LineBreak)
 
 
editor.InsertLine("Application Name")
editor.InsertLine("Application ID")
editor.InsertLine("Status")
editor.InsertLine("Deadline Date")
Dinko | Tech Support Engineer
Telerik team
 answered on 28 Feb 2017
1 answer
271 views

Hello,

Is there a way to read/update document custom properties?

Say I have a document that has fields inserted into the text (with DOCPROPERTY) that are pointing to a custom document property. I would like to open the document, update the custom document properties and then do an update of all fields (I found I can trigger the update thru UpdateFields method or when Exporting by setting the appropriate flag).

I have not found any mention in the documentation about how I would be able to update an existing document custom property. Could someone point me in the right direction?

Thank you

Tanya
Telerik team
 answered on 24 Feb 2017
6 answers
157 views

Hello,

i have trouble reading small numbers from xlsx-files by using the spread processing components. in the attached file you can see an example. column A contains the values i want to read  which are computed from row 2 to row 8. the used formula can be seen in column B. column C contains the values that the spread processing is able to read using

 

workbook.Worksheets[0].Cells[4,0].GetValue().Value.GetResultValueAsString(CellValueFormat.GeneralFormat)

 

i'm able to read small numbers that aren't computed by using 

 

workbook.Worksheets[0].Cells[4,0].GetValue().Value.RawValue

 

what is the proper way to read the computed result values?

Dinko | Tech Support Engineer
Telerik team
 answered on 17 Feb 2017
Narrow your results
Selected tags
Tags
+? more
Top users last month
Simon
Top achievements
Rank 2
Iron
Iron
Bob
Top achievements
Rank 3
Iron
Iron
Veteran
Marco
Top achievements
Rank 4
Iron
Iron
Iron
Grant
Top achievements
Rank 3
Iron
Iron
Iron
Kao Hung
Top achievements
Rank 1
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Simon
Top achievements
Rank 2
Iron
Iron
Bob
Top achievements
Rank 3
Iron
Iron
Veteran
Marco
Top achievements
Rank 4
Iron
Iron
Iron
Grant
Top achievements
Rank 3
Iron
Iron
Iron
Kao Hung
Top achievements
Rank 1
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?