Skip to content

Commit 9013081

Browse files
authored
Merge pull request #1770 from syncfusion-content/988630-EnablePartialTrustCode
988630-FAQ for when to use EnablePartialTrustCode property
2 parents 885dee6 + 66f0799 commit 9013081

File tree

2 files changed

+46
-0
lines changed

2 files changed

+46
-0
lines changed

Document-Processing-toc.html

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5906,6 +5906,19 @@
59065906
<li>
59075907
<a href="/document-processing/excel/excel-library/net/faqs/how-to-access-the-built-in-properties-of-Excel-documents">How to access the built-in properties of Excel documents?</a>
59085908
</li>
5909+
<li>
5910+
<a href="/document-processing/excel/excel-library/net/faqs/how-to-get-the-column-width-and-row-height-in-pixels">How to get the column width and row height in pixels?</a>
5911+
</li>
5912+
<li>
5913+
<a href="/document-processing/excel/excel-library/net/faqs/does-xlsio-support-sensititivity-labels">Does XlsIO support sensitivity labels?</a>
5914+
</li>
5915+
<li>
5916+
<a href="/document-processing/excel/excel-library/net/faqs/how-to-set-hex-color-value-to-the-cell">How to set a hex color value for a cell?</a>
5917+
</li>
5918+
<li>
5919+
<a href="/document-processing/excel/excel-library/net/faqs/in-which-situation-we-use-EnablePartialTrustCode-property">When should use EnablePartialTrustCode property?</a>
5920+
</li>
5921+
59095922
</ul>
59105923
</li>
59115924
</ul>
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
---
2+
title: When to use EnablePartialTrustCode in XlsIO | Syncfusion
3+
description: Learn when to enable the EnablePartialTrustCode property in Syncfusion XlsIO—primarily on Azure—to avoid EMF/WMF GDI+ errors during Excel-to-PDF conversion.
4+
platform: document-processing
5+
control: XlsIO
6+
documentation: UG
7+
---
8+
9+
# When should use EnablePartialTrustCode property?
10+
11+
Enable the EnablePartialTrustCode property only in restricted, hosted environments such as Azure App Service. Because, there will be a GDI+ exception thrown while handling meta file images such as emf and wmf formats. When this property is enabled, the images will not be rendered instead of throwing exception.
12+
13+
N> Azure or other sandboxes hosting: set EnablePartialTrustCode = true to bypass EMF/WMF GDI+ exceptions.
14+
Other environments: keep EnablePartialTrustCode = false for full‑fidelity image rendering.
15+
16+
Use the following code snippet to set the EnablePartialTrustCode property
17+
18+
{% tabs %}
19+
{% highlight c# tabtitle="C# [Cross-platform]" %}
20+
IApplication application = excelEngine.Excel;
21+
application.EnablePartialTrustCode = false; // Setting the EnablePartialTrustCode to false
22+
{% endhighlight %}
23+
24+
{% highlight c# tabtitle="C# [Windows-specific]" %}
25+
IApplication application = excelEngine.Excel;
26+
application.EnablePartialTrustCode = false; // Setting the EnablePartialTrustCode to false
27+
{% endhighlight %}
28+
29+
{% highlight vb.net tabtitle="VB.NET [Windows-specific]" %}
30+
Dim application As IApplication = excelEngine.Excel
31+
application.EnablePartialTrustCode = False ' Setting EnablePartialTrustCode to False
32+
{% endhighlight %}
33+
{% endtabs %}

0 commit comments

Comments
 (0)