Skip to content

Commit 0ec1060

Browse files
Merge pull request #232 from Yaminisrisf4389/main
Modify DocIO GitHub and UG for document processing playground
2 parents ec34150 + 4fa32d2 commit 0ec1060

File tree

3 files changed

+9
-6
lines changed

3 files changed

+9
-6
lines changed

Paragraphs/Extract-ole-object/.NET/Extract-ole-object/Extract-ole-object.csproj

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,9 @@
1414
<None Update="Data\Template.docx">
1515
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
1616
</None>
17+
<None Update="Output\.gitkeep">
18+
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
19+
</None>
1720
</ItemGroup>
1821

1922
</Project>

Paragraphs/Extract-ole-object/.NET/Extract-ole-object/Program.cs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ class Program
88
{
99
static void Main(string[] args)
1010
{
11-
using (FileStream fileStreamPath = new FileStream(Path.GetFullPath(@"../../../Template.docx"), FileMode.Open, FileAccess.Read, FileShare.ReadWrite))
11+
using (FileStream fileStreamPath = new FileStream(Path.GetFullPath(@"Data/Template.docx"), FileMode.Open, FileAccess.Read, FileShare.ReadWrite))
1212
{
1313
//Opens an input Word template.
1414
using (WordDocument document = new WordDocument(fileStreamPath, FormatType.Automatic))
@@ -47,15 +47,15 @@ private static void ExtractOLEObject(WordDocument document)
4747
{
4848
if ((oleTypeStr.Contains("Excel Worksheet") || oleTypeStr.StartsWith("Excel.Sheet.12")))
4949
{
50-
FileStream fstream = new FileStream(Path.GetFullPath(@"../../../Workbook" + oleObject.OleStorageName + ".xlsx"), FileMode.Create);
50+
FileStream fstream = new FileStream(Path.GetFullPath(@"Output/Workbook" + oleObject.OleStorageName + ".xlsx"), FileMode.Create);
5151
fstream.Write(oleObject.NativeData, 0, oleObject.NativeData.Length);
5252
fstream.Flush();
5353
fstream.Close();
5454
break;
5555
}
5656
else
5757
{
58-
FileStream fstream = new FileStream(Path.GetFullPath(@"../../../Workbook" + oleObject.OleStorageName + ".xls"), FileMode.Create);
58+
FileStream fstream = new FileStream(Path.GetFullPath(@"Output/Workbook" + oleObject.OleStorageName + ".xls"), FileMode.Create);
5959
fstream.Write(oleObject.NativeData, 0, oleObject.NativeData.Length);
6060
fstream.Flush();
6161
fstream.Close();
@@ -67,15 +67,15 @@ private static void ExtractOLEObject(WordDocument document)
6767
{
6868
if (oleTypeStr.Contains("Word.Document.12"))
6969
{
70-
FileStream fstream = new FileStream(Path.GetFullPath(@"../../../Sample" + oleObject.OleStorageName + ".docx"), FileMode.Create);
70+
FileStream fstream = new FileStream(Path.GetFullPath(@"Output/Sample" + oleObject.OleStorageName + ".docx"), FileMode.Create);
7171
fstream.Write(oleObject.NativeData, 0, oleObject.NativeData.Length);
7272
fstream.Flush();
7373
fstream.Close();
7474
break;
7575
}
7676
else if (oleTypeStr.Contains("Word.Document.8"))
7777
{
78-
FileStream fstream = new FileStream(Path.GetFullPath(@"../../../Sample" + oleObject.OleStorageName + ".doc"), FileMode.Create);
78+
FileStream fstream = new FileStream(Path.GetFullPath(@"Output/Sample" + oleObject.OleStorageName + ".doc"), FileMode.Create);
7979
fstream.Write(oleObject.NativeData, 0, oleObject.NativeData.Length);
8080
fstream.Flush();
8181
fstream.Close();
@@ -85,7 +85,7 @@ private static void ExtractOLEObject(WordDocument document)
8585
//Checks for PDF embedded object and save them.
8686
if (oleTypeStr.Contains("Acrobat Document") || oleTypeStr.StartsWith("AcroExch.Document.7") || (oleTypeStr.Contains("AcroExch.Document.11") || oleTypeStr.StartsWith("AcroExch.Document.DC")))
8787
{
88-
FileStream fstream = new FileStream(Path.GetFullPath(@"../../../Sample" + oleObject.OleStorageName + ".pdf"), FileMode.Create);
88+
FileStream fstream = new FileStream(Path.GetFullPath(@"Output/Sample" + oleObject.OleStorageName + ".pdf"), FileMode.Create);
8989
fstream.Write(oleObject.NativeData, 0, oleObject.NativeData.Length);
9090
fstream.Flush();
9191
fstream.Close();
Binary file not shown.

0 commit comments

Comments
 (0)