Telerik Forums
Telerik Document Processing Forum
1 answer
215 views

Hello, I have the following situation:

 

My application has a set of actions defined by the adminsitrator, in this case I have two actions where the application extracts a single sheet from a given xlsx file, fills it with data. Later another action extracts the other sheet from the same xlsx file, fills it with data too. And then the application, as it notices that the file being modified is the same resulting file, tries to merge back both sheets in a single xlsx file.

 

My problem is, both sheets have some complex styling, and after trying to merge both sheets in a single file, everything stays in place except for some font styles/colors/... Is there any way to achieve a merge of both sheets without losing those styles?

 

I'm attaching some screenshots, in case you need the original file let me know how to send it.

Thanks

Tanya
Telerik team
 answered on 14 Jun 2017
1 answer
175 views
Looking to create an windows/console application that generates a one page pdf file.  The file will contain a chart.  Is there an easy way to do this using Telerik charts and export to pdf function?
Boby
Telerik team
 answered on 13 Jun 2017
1 answer
157 views

Hello,
I'm importing an html which contains table (100x6), This process is becoming very time consuming when my cells have borders. See the times below:

Code:

var provider = new HtmlFormatProvider();
Provider.Import(html);

With borders => 12 seconds (https://jsfiddle.net/kya78c0m/)
No borders => 1 seconds (https://jsfiddle.net/3eucxd2e/)

Is there any way to reduce this time when I'm using borders?

Deyan
Telerik team
 answered on 30 May 2017
4 answers
550 views
How do I convert an image element back to an image to be able to manipulate the image.
Mark Stevens
Top achievements
Rank 1
 answered on 29 May 2017
2 answers
161 views

Hi,

We are getting the following exception when importing a PDF:with version 2016.2.815

 

Type: System.NotImplementedException
Message: The method or operation is not implemented.
Source: Telerik.Windows.Documents.Fixed
TargetSite: Telerik.Windows.Documents.Fixed.FormatProviders.Pdf.Model.Elements.ColorSpaces.ColorBase GetColor(Telerik.Windows.Documents.Fixed.FormatProviders.Pdf.Model.Types.PdfArray)
StackTrace:    at Telerik.Windows.Documents.Fixed.FormatProviders.Pdf.Model.Elements.ColorSpaces.IccBased.GetColor(PdfArray components)
   at Telerik.Windows.Documents.Fixed.FormatProviders.Pdf.Operators.Color.SetColorNBase.LoadPatternColor(ContentStreamInterpreter interpreter, IPdfContentImportContext context, Pattern patternColorSpace)
   at Telerik.Windows.Documents.Fixed.FormatProviders.Pdf.Operators.Color.SetColorNBase.Execute(ContentStreamInterpreter interpreter, IPdfContentImportContext context)
   at Telerik.Windows.Documents.Fixed.FormatProviders.Pdf.Import.ContentStreamInterpreter.Execute()
   at Telerik.Windows.Documents.Fixed.FormatProviders.Pdf.Model.Elements.DocumentStructure.ContentStream.CopyPropertiesTo(PostScriptReader reader, IPdfImportContext context, IResourceHolder resourceHolder, IContentRootElement contentRoot)
   at Telerik.Windows.Documents.Fixed.FormatProviders.Pdf.Model.Elements.DocumentStructure.Page.CopyPropertiesTo(PostScriptReader reader, IPdfImportContext context, RadFixedPage fixedPage)
   at Telerik.Windows.Documents.Fixed.FormatProviders.Pdf.Model.Elements.DocumentStructure.DocumentCatalog.CopyPropertiesTo(PostScriptReader reader, IPdfImportContext context)
   at Telerik.Windows.Documents.Fixed.FormatProviders.Pdf.Import.RadFixedDocumentImportContext.BeginImport(PostScriptReader reader)
   at Telerik.Windows.Documents.Fixed.FormatProviders.Pdf.PdfFormatProvider.ImportOverride(Stream input)

 

I assume there is something about the PDF and its colours that is not supported in the PdfProcessing classes.  Any idea what that might be and how we can work around it?

Scott Waye
Top achievements
Rank 2
Iron
Iron
Veteran
 answered on 29 May 2017
2 answers
274 views

Hello,

When exporting to PDF is not respecting cell color #FF0000(RED), it is always turning black.

Result Attach

Code:

HtmlFormatProvider prov = new HtmlFormatProvider();
RadFlowDocument document = prov.Import(@"<table><tbody><td style="""">NO-BORDER-COLOR</td><td style=""border:5px;border-style:solid;border-color:#FF0000;"">WITH-BORDER-COLOR-RED</td></tr></tbody></table>");
 
var provider = new Telerik.Windows.Documents.Flow.FormatProviders.Pdf.PdfFormatProvider();
var ouput = provider.Export(document);
File.WriteAllBytes(@"D:\b.pdf", ouput);

 

william
Top achievements
Rank 1
 answered on 25 May 2017
1 answer
164 views
 I have existing PDF documents which were generated with the incorrect background color and need to programmatically change the color from black background to white but I haven't found a way to do this.Is there a property on the page which I can change or do I have to go through all the elements??
Mark Stevens
Top achievements
Rank 1
 answered on 23 May 2017
2 answers
876 views
I have a report that is currently generated by hand.  It is a 4 page report that is done by hand in Word.  Each page has text, images and dynamic data (some of which is inside paragraphs of text, bullet lists etc.  On page 4 is a data table.  I am trying to figure out the best approach to automate this report.  Should I use a Telerik Report, DocProcessing to generate it (which seems tedious with a RadFixedDocument), a word or html template??   Any suggestions?
Jeffrey
Top achievements
Rank 1
 answered on 22 May 2017
1 answer
439 views

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 attachments
05.var q = from a in db.Attachments
06.    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 zip
25.    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 error
35.// *************
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.            else
50.                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.}

 

 

Boby
Telerik team
 answered on 22 May 2017
1 answer
125 views

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

 

Tanya
Telerik team
 answered on 10 May 2017
Narrow your results
Selected tags
Tags
+? more
Top users last month
Ambisoft
Top achievements
Rank 2
Iron
Pascal
Top achievements
Rank 2
Iron
Matthew
Top achievements
Rank 1
Sergii
Top achievements
Rank 1
Iron
Iron
Andrey
Top achievements
Rank 1
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Ambisoft
Top achievements
Rank 2
Iron
Pascal
Top achievements
Rank 2
Iron
Matthew
Top achievements
Rank 1
Sergii
Top achievements
Rank 1
Iron
Iron
Andrey
Top achievements
Rank 1
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?