Telerik Forums
Telerik Document Processing Forum
1 answer
28 views

Hi,

Starting from thursday April 5th we cannot access (connection timeout) the Telerik NuGet feed: https://nuget.telerik.com/v3/index.json 

Dess | Tech Support Engineer, Principal
Telerik team
 updated question on 08 Apr 2024
1 answer
4 views

When i import an XLSX file and save it, Excell table are gone.
I use this table name in some formules.

I want insert some dynamic header information and some rows to the table.

I cant find any documentation which other things will be lost when i export the file.

    private void OpenFile()
    {
        string fileName = @"Template.xlsx";
        _xlsxProvider = new XlsxFormatProvider();

        using (Stream stream = File.OpenRead(fileName))
        {
            try
            {
                _workbook = _xlsxProvider.Import(stream);
                _worksheet = _workbook.ActiveWorksheet;
                _workbook.History.IsEnabled = false;
            }
            catch (Exception)
            {
                Console.WriteLine("Could not open file.");
            }
        }
    }
 public Stream GetOutputStream()
 {
     Stream stream = new MemoryStream();
     _xlsxProvider.Export(_workbook, stream);
     stream.Position = 0;
     return stream;
 } 

var stream  = _excelService.GetOutputStream();
 //write stream to fole
 using (var fileStream = File.Create("Output.xlsx"))
 {
     await stream.CopyToAsync(fileStream);
 }

Is it possible to keep the table when exporting.
Dess | Tech Support Engineer, Principal
Telerik team
 answered on 25 Apr 2024
1 answer
17 views

Hello, I have a PDF form where I am manipulating the fields.  When I try to use the example code I get the error - The method or operation is not implemented.  The current trial version works with this code, but I am using an old version.  Is this possible with the version I am using?

The form part seems to work ok, I just get the error on the final line.   Is there another way to save the file with the R1.2021 version?  Thank you!

File.WriteAllBytes(outputPath, pdfProvider.Export(document));

Full code from example:

 string inputPath = System.Web.HttpContext.Current.Request.PhysicalApplicationPath + "PDFs\\ce_certificate.pdf";
 string fileName = "certificate_" + drCE["series_id"] + "_" + drCE["member_id"] + ".pdf";
 string outputPath = System.Web.HttpContext.Current.Request.PhysicalApplicationPath + "PDFs\\CECertificates\\" + fileName;

 Telerik.Windows.Documents.Fixed.FormatProviders.Pdf.PdfFormatProvider pdfProvider = new Telerik.Windows.Documents.Fixed.FormatProviders.Pdf.PdfFormatProvider();
 RadFixedDocument document = pdfProvider.Import(File.ReadAllBytes(inputPath));

 foreach (RadFixedPage page in document.Pages)
 {
     foreach (Annotation annotation in page.Annotations)
     {
         if (annotation.Type == AnnotationType.Widget)
         {
             Widget widget = (Widget)annotation;
             var field = widget.Field as TextBoxField;
             if (field != null)
             {
                 switch (field.Name)
                 {
                     case "member_name":
                         field.Value = drCE["full_name"].ToString();
                         break;
                     case "course_name":
                         field.Value = drCE["title"].ToString();
                         break;
                     case "ce_credits":
                         field.Value = drCE["total_credits"].ToString();
                         break;
                     case "completed_date":
                         field.Value = DateTime.Parse(drCE["complete_date"].ToString()).ToShortDateString();
                         break;
                 }
             }
         }
     }
 }


 //not implemented in our version
 //document.AcroForm.FlattenFormFields();

 //not implemented in our version
 File.WriteAllBytes(outputPath, pdfProvider.Export(document));

Yoan
Telerik team
 answered on 15 Apr 2024
1 answer
8 views

I'm able to export data to an .xlsx file.  That file is exported to E:/SaoApps/Sims/wwwroot/exports and the user has full control over that folder.  The file successfully is created at that location.  But the file doesn't open or offer download to the user and the error message is:

In the attached code snippet, the passed exportsFolder = "E:/SaoApps/Sims/wwwroot/exports/" and passed lanId = "DSS"

"An error occurred trying to start process 'E:/SaoApps/Sims/wwwroot/exports/ContactsSearchResults_DSS.xlsx' with working directory 'E:\\Workspace\\Intranet\\Sims\\Sims'. The process cannot access the file because it is being used by another process."

 

System.ComponentModel.Win32Exception (32): An error occurred trying to start process 'E:/SaoApps/Sims/wwwroot/exports/ContactsSearchResults_DSS.xlsx' with working directory 'E:\Workspace\Intranet\Sims\Sims'. The process cannot access the file because it is being used by another process.
   at System.Diagnostics.Process.StartWithCreateProcess(ProcessStartInfo startInfo)
   at System.Diagnostics.Process.Start()
   at System.Diagnostics.Process.Start(ProcessStartInfo startInfo)
   at Sims.Agency.Data.Services.AgencyExportService.ExportContactSearchResults(String criteria, List`1 searchResults) in E:\Workspace\Intranet\Sims\Sims.Agency.Data\Services\AgencyExportService.cs:line 424
   at Sims.Contacts.Pages.ContactSearchBase.ExportToExcel() in E:\Workspace\Intranet\Sims\Sims.Contacts\Pages\ContactSearchBase.cs:line 327
   at Microsoft.AspNetCore.Components.ComponentBase.CallStateHasChangedOnAsyncCompletion(Task task)
   at Microsoft.AspNetCore.Components.RenderTree.Renderer.GetErrorHandledTask(Task taskToHandle, ComponentState owningComponentState)
Yoan
Telerik team
 answered on 12 Apr 2024
1 answer
24 views

4, 1, 0 votes why??????????????????????????????????????????????????????????????????????????????????????????????????????????????????

 

why most rated ignored???????????????????????????????????????????????????????????????????????????????????????????????????????????

 

Dess | Tech Support Engineer, Principal
Telerik team
 updated answer on 22 Mar 2024
1 answer
28 views

I am trying to create a pdf page using the pdfprocessing library.

The page has a number of tables with mostly text and a few images. I think I am ok with handling these.

I am building up the page in a RadFixedPage added to a RadFixedDocument.

However, in one of the table cells I need to be able to insert a block of rtf formatted text.

This is user entered using a RadRichTextBox and saved to a string field in code-behind using RtfDataProvider

A typical block of rtf may be:

{\rtf1\ansi\ansicpg1252\uc1\deff0\deflang1033{\fonttbl{\f0 Segoe UI;}{\f1 Times New Roman;}{\f2 Verdana;}}{\colortbl\red0\green0\blue0 ;\red0\green176\blue80 ;\red255\green192\blue0 ;\red250\green250\blue250 ;\red0\green0\blue255 ;}{\*\defchp\ltrch\f0\fs18\i0\b0\strike0\cf0\ulc0\ulnone}{\*\defpap\sl276\slmult1\ql\sa180\ltrpar}{\stylesheet{\s0\sqformat\spriority0\ltrch\f0\fs18\i0\b0\strike0\cf0\ulc0\ulnone\sl276\slmult1\ql\ltrpar Normal;}{\*\ts2\tsrowd\spriority59\trbrdrt\brdrnone\trbrdrb\brdrnone\trbrdrl\brdrnone\trbrdrr\brdrnone\trbrdrh\brdrnone\trbrdrv\brdrnone\trgaph0\trpaddl75\trpaddr75\trpaddt0\trpaddb0\clpadft3\clpadt0\clpadfr3\clpadr0\clpadfl3\clpadl0\clpadfb3\clpadb0\tsvertalt\ltrch\f0\fs18\i0\b0\strike0\cf0\ulc0\ulnone\sl276\slmult1\ql\sa180\ltrpar Table Normal;}{\s3\spriority99\ltrch\f0\fs18\i0\b0\strike0\cf0\ulc0\ulnone\sl276\slmult1\ql\sb100\sa100\sbauto1\saauto1\ltrpar Normal (Web);}}\nouicompat\viewkind4\sectd\headery720\footery720\pard\sl276\slmult1\qc\ltrpar{\ltrch\f0\fs18\i\b\strike0\cf1\cb2\highlight2\ulc0\ulnone line }{\ltrch\f0\fs18\i0\b0\strike0\cf0\ulc0\ulnone 1}{\ltrch\f0\fs18\i0\b0\strike0\cf0\ulc0\ulnone\par}\pard\sl276\slmult1\ql\ltrpar{\ltrch\f1\fs18\i\b0\strike0\cf0\cb3\highlight3\ulc0\ulnone sDefaultStyleSettings}{\ltrch\f1\fs18\i0\b0\strike0\cf0\cb3\highlight3\ulc0\ulnone =}{\ltrch\f1\fs18\i0\b0\strike0\cf4\cb3\highlight3\ulc0\ulnone "True"}{\ltrch\f0\fs18\i0\b\strike0\cf0\ulc0\ulnone\par}\pard\sl276\slmult1\ql\ltrpar{\ltrch\f0\fs18\i0\b0\strike0\cf0\ulc0\ulnone linr 3s}{\ltrch\f0\fs18\i0\b\strike0\cf0\ulc0\ulnone lin 2}{\ltrch\f1\fs18\i0\b0\strike0\cf0\cb3\highlight3\ulc0\ulnone DocumentInherit}{\ltrch\f0\fs18\i0\b\strike0\cf0\ulc0\ulnone\par}}

 

For inserting normal text I have been using

            row = table.Rows.AddTableRow();
            cell = row.Cells.AddTableCell();
            cell.Blocks.AddBlock().InsertText(Language.Language.ProductName);

any suggestions how I can insert rtf rather than plain text?

Thanks

Andrew

Yoan
Telerik team
 answered on 26 Feb 2024
1 answer
21 views
I have a DOCX Template that has multiple merge fields defined. One of those fields is for an image. How can I get MailMerge to insert images into a merge field.
Dess | Tech Support Engineer, Principal
Telerik team
 answered on 23 Feb 2024
0 answers
30 views
Hello! I'm currently attempting to transform an HTML body into a PDF using HtmlFormatProvider, RadFlowDocument, and PdfFormatProvider.

Everything functions good when generating a PDF with standard characters. However, when incorporating characters such as "ćšđž," these specific characters seem to be missing.

Could you kindly provide guidance on resolving this issue?
Sanja Tolo
Top achievements
Rank 1
Iron
Iron
 asked on 09 Feb 2024
0 answers
45 views

I created a test docx with the following text in a justified format:

"This is a brand-new document with justified text.  Putting extra text into the paragraph in order to highlight the specific justified format text.  This is simply test text in order to demonstrate the issue that I am having when I attempt to use the Telerik rad document find all."

I then upload the document into Session and save the file binary by converting the File.InputStream to Base64Stream.

I then create a find text of "This is simply test text".

The resulting IReadOnlyCollection<FindResult> of editor.FindAll(txtFind, false, true); contains one result with three runs.

"highlight the specific justified format text. This is simply"

"test"

"text in order to demonstrate the issue that I am having when I attempt to use the Telerik rad document find all.

 

I had assumed that setting match whole word would return a better result, but it does not.

I think I do not understand the concept of "runs".  There is no other formatting other than justification.  

I expected either the sentence that the text resides in to return OR the entire paragraph.  Not three incomplete sentences, one just including one word.

Patrick
Top achievements
Rank 1
 updated question on 06 Feb 2024
0 answers
42 views

Hello

I'm trying to create an Excel xlsx spreadsheet from data in a data table. I'm having trouble setting / defining cell borders. I would like to define a bottom black thin border for a range of cells.

I'm using this as a reference https://docs.telerik.com/devtools/document-processing/libraries/radspreadprocessing/working-with-cells/get-set-clear-properties#borders-property

I've started with this...

Workbook workbook = new Workbook();
Worksheet worksheet = workbook.Worksheets.Add();

ThemableColor black = new ThemableColor(Color.FromArgb(0, 0, 0, 0));
CellBorders blackBorders = new CellBorders(new CellBorder(CellBorderStyle.Thin, black));
worksheet.Cells[4, 0, 4, 9].SetBorders(blackBorders);

In Visual Studio, ThemableColor and Color are underlined in red. When I mouse over it says 'The name 'Color' does not exist in the current context'.

Am I missing a reference or using statement to be able to use ThemableColor?

Andrew
Top achievements
Rank 1
 asked on 30 Jan 2024
Narrow your results
Selected tags
Tags
+? more
Top users last month
Dominik
Top achievements
Rank 1
Giuliano
Top achievements
Rank 1
Dominic
Top achievements
Rank 1
Glendys
Top achievements
Rank 1
Iron
NoobMaster
Top achievements
Rank 2
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Dominik
Top achievements
Rank 1
Giuliano
Top achievements
Rank 1
Dominic
Top achievements
Rank 1
Glendys
Top achievements
Rank 1
Iron
NoobMaster
Top achievements
Rank 2
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?