Skip to content

Commit 96e8992

Browse files
author
Website Automation
committed
Merge remote-tracking branch 'remotes/origin/hotfix/hotfix-v31.2.12'
2 parents 8fafe78 + 4ddb30e commit 96e8992

File tree

4 files changed

+163
-11
lines changed

4 files changed

+163
-11
lines changed

Document-Processing-toc.html

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5868,7 +5868,7 @@
58685868
<a href="/document-processing/excel/excel-library/net/faqs/does-xlsio-auto-adjust-chart-axis-minimum-and-maximum-values">Does XlsIO auto-adjust chart axis minimum and maximum values?</a>
58695869
</li>
58705870
<li>
5871-
<a href="/document-processing/excel/excel-library/net/faqs/does-xlsio-prefix-pivot-table-calculated-field-headers-with-sum-of">Does XlsIO prefix PivotTable calculated field headers with "Sum of"?</a>
5871+
<a href="/document-processing/excel/excel-library/net/faqs/does-xlsio-prefix-pivot-table-calculated-field-headers-with-sum-of">Does XlsIO prefix PivotTable calculated field headers with Sum of?</a>
58725872
</li>
58735873
<li>
58745874
<a href="/document-processing/excel/excel-library/net/faqs/can-pivot-tables-share-calculate-field-names">Can PivotTables share calculated field names?</a>
@@ -5879,6 +5879,18 @@
58795879
<li>
58805880
<a href="/document-processing/excel/excel-library/net/faqs/what-is-the-unit-of-row-height-and-column-width-in-Excel">What is the unit of row height and column width in Excel?</a>
58815881
</li>
5882+
<li>
5883+
<a href="/document-processing/excel/excel-library/net/faqs/how-to-apply-the-formatting-for-a-particular-column-while-importing-data-from-collection-objects">How to apply formatting to a specific column while importing data?</a>
5884+
</li>
5885+
<li>
5886+
<a href="/document-processing/excel/excel-library/net/faqs/how-to-align-the-image-inside-the-cell">How to align a picture inside a cell in an Excel worksheet?</a>
5887+
</li>
5888+
<li>
5889+
<a href="/document-processing/excel/excel-library/net/faqs/how-to-resolve-the-cannot-open-Pivot-table-source-file-error">How to resolve the cannot open pivot table source file error?</a>
5890+
</li>
5891+
<li>
5892+
<a href="/document-processing/excel/excel-library/net/faqs/how-to-extract-embedded-OLE-files-from-an-Excel-workbook-as-streams">How to extract embedded OLE files from an Excel workbook as streams?</a>
5893+
</li>
58825894
</ul>
58835895
</li>
58845896
</ul>

Document-Processing/Excel/Excel-Library/NET/create-read-edit-excel-files-in-aws-lambda.md

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -222,17 +222,9 @@ using (ExcelEngine excelEngine = new ExcelEngine())
222222
worksheet.Range["A9:A14"].RowHeight = 15;
223223
worksheet.Range["A15:A23"].RowHeight = 18;
224224

225-
//Saving the Excel to the MemoryStream
226-
MemoryStream stream = new MemoryStream();
225+
MemoryStream stream = new MemoryStream();
227226
workbook.SaveAs(stream);
228-
229-
//Set the position as '0'.
230-
stream.Position = 0;
231-
232-
//Download the Excel file in the browser
233-
FileStreamResult fileStreamResult = new FileStreamResult(stream, "application/excel");
234-
fileStreamResult.FileDownloadName = "Output.xlsx";
235-
return fileStreamResult;
227+
return Convert.ToBase64String(stream.ToArray());
236228
}
237229

238230
{% endhighlight %}
Lines changed: 105 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,105 @@
1+
---
2+
title: Align a picture inside a cell in an Excel worksheet | Syncfusion
3+
description: Learn how to align an image precisely within a worksheet cell using the Syncfusion .NET Excel (XlsIO) library, including positioning, fitting to the cell.
4+
platform: document-processing
5+
control: XlsIO
6+
documentation: UG
7+
---
8+
9+
# How to align a picture inside a cell in an Excel worksheet?
10+
11+
Image can be aligned in the cell as required using the **TopRowOffset** and **LeftColumnOffset** properties of **ShapeImpl** instance. The following example shows how to align a picture inside a worksheet cell using the Syncfusion .NET Excel (XlsIO) library.
12+
13+
{% tabs %}
14+
{% highlight c# tabtitle="C# [Cross-platform]" %}
15+
using (ExcelEngine excelEngine = new ExcelEngine())
16+
{
17+
IApplication application = excelEngine.Excel;
18+
application.DefaultVersion = ExcelVersion.Xlsx;
19+
IWorkbook workbook = application.Workbooks.Create(1);
20+
IWorksheet worksheet = workbook.Worksheets[0];
21+
22+
int row = 2;
23+
int column = 3;
24+
25+
//Adding a picture
26+
FileStream imageStream = new FileStream("../../../Data/Image.png", FileMode.Open, FileAccess.Read);
27+
IPictureShape shape = worksheet.Pictures.AddPicture(row, column, imageStream);
28+
29+
//Insert the image into the cell
30+
(shape as ShapeImpl).Height = worksheet.GetRowHeightInPixels(row);
31+
(shape as ShapeImpl).Width = worksheet.GetColumnWidthInPixels(column);
32+
33+
//Algin the image inside the cell
34+
(shape as ShapeImpl).TopRowOffset = 50;
35+
(shape as ShapeImpl).LeftColumnOffset = 50;
36+
37+
#region Save
38+
//Saving the workbook
39+
workbook.SaveAs("../../../Output/Picture.xlsx");
40+
#endregion
41+
42+
//Dispose streams
43+
imageStream.Dispose();
44+
}
45+
{% endhighlight %}
46+
47+
{% highlight c# tabtitle="C# [Windows-specific]" %}
48+
using (ExcelEngine excelEngine = new ExcelEngine())
49+
{
50+
IApplication application = excelEngine.Excel;
51+
application.DefaultVersion = ExcelVersion.Xlsx;
52+
IWorkbook workbook = application.Workbooks.Create(1);
53+
IWorksheet worksheet = workbook.Worksheets[0];
54+
55+
int row = 2;
56+
int column = 3;
57+
58+
//Adding a picture
59+
string image = "../../Data/Image.png";
60+
IPictureShape shape = worksheet.Pictures.AddPicture(row, column, image);
61+
62+
// Insert the image into the cell
63+
(shape as ShapeImpl).Height = worksheet.GetRowHeightInPixels(row);
64+
(shape as ShapeImpl).Width = worksheet.GetColumnWidthInPixels(column);
65+
66+
//Algin the image inside the cell
67+
(shape as ShapeImpl).TopRowOffset = 50;
68+
(shape as ShapeImpl).LeftColumnOffset = 50;
69+
70+
#region Save
71+
//Saving the workbook
72+
workbook.SaveAs("../../Output/Picture.xlsx");
73+
#endregion
74+
}
75+
{% endhighlight %}
76+
77+
{% highlight vb.net tabtitle="VB.NET [Windows-specific]" %}
78+
Using excelEngine As New ExcelEngine()
79+
Dim application As IApplication = excelEngine.Excel
80+
application.DefaultVersion = ExcelVersion.Xlsx
81+
82+
Dim workbook As IWorkbook = application.Workbooks.Create(1)
83+
Dim worksheet As IWorksheet = workbook.Worksheets(0)
84+
85+
Dim row As Integer = 2
86+
Dim column As Integer = 3
87+
88+
' Adding a picture
89+
Dim image As String = "../../Data/Image.png"
90+
Dim shape As IPictureShape = worksheet.Pictures.AddPicture(row, column, image)
91+
92+
' Insert the image into the cell
93+
Dim impl As ShapeImpl = CType(shape, ShapeImpl)
94+
impl.Height = worksheet.GetRowHeightInPixels(row)
95+
impl.Width = worksheet.GetColumnWidthInPixels(column)
96+
97+
' Align the image inside the cell
98+
impl.TopRowOffset = 50
99+
impl.LeftColumnOffset = 50
100+
101+
' Save
102+
workbook.SaveAs("../../Output/Picture.xlsx")
103+
End Using
104+
{% endhighlight %}
105+
{% endtabs %}
Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
---
2+
title: Extract embedded OLE files from Excel as streams | Syncfusion
3+
description: This page shows how to extract embedded OLE objects from Excel as streams using the Syncfusion .NET Excel (XlsIO) library.
4+
platform: document-processing
5+
control: XlsIO
6+
documentation: UG
7+
---
8+
9+
# How to extract embedded OLE files from an Excel workbook as streams?
10+
11+
You can extract OLE objects in an Excel workbook as streams using XlsIO. The following example demonstrates how to retrieve embedded files from a worksheet.
12+
{% tabs %}
13+
{% highlight c# tabtitle="C# [Cross-platform]" %}
14+
using (ExcelEngine excelEngine = new ExcelEngine())
15+
{
16+
//Create worksheet
17+
IApplication application = excelEngine.Excel;
18+
application.DefaultVersion = ExcelVersion.Xlsx;
19+
IWorkbook workbook = application.Workbooks.Create(1);
20+
IWorksheet worksheet = workbook.Worksheets[0];
21+
22+
FileStream embedStream = new FileStream("../../../Sample.docx", FileMode.Open);
23+
FileStream imageStream = new FileStream("../../../wordIcon.jpg", FileMode.Open);
24+
25+
//Create image stream
26+
Image image = Image.FromStream(imageStream);
27+
28+
//Add ole object
29+
IOleObject oleObject = worksheet.OleObjects.Add(embedStream, image, OleObjectType.WordDocument);
30+
31+
// Get the OLE part stream.
32+
Image image1 = Image.FromStream(worksheet.OleObjects[0].GetEmbeddedOleStream());
33+
MemoryStream memory = new MemoryStream(image1.ImageData);
34+
35+
//Saving the workbook as stream
36+
FileStream stream = new FileStream("ExtractedFile.xlsx", FileMode.Create, FileAccess.Write);
37+
memory.CopyTo(stream);
38+
workbook.SaveAs(stream);
39+
stream.Dispose();
40+
}
41+
{% endhighlight %}
42+
43+
{% endtabs %}

0 commit comments

Comments
 (0)