Click here to Skip to main content
15,890,366 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
Do anyone know why "Open XML SDK 2.0 for Microsoft Office" need .net framework 3.5 SP1?

I installed .net framework 4.
It contains .net framework,doesn't it?

The SDK installer required .net framework 3.5 sp1.

If my .net4 app which is made by the SDK distribute other machines, do they need framework 3.5 sp1?
Posted

I'm not 100% sure, but I would assume it was because the SDK was originally built upon .NET 3.5 SP1?

Eitherway, take a look at this[^]. .NET 4.0 is just a superset of .NET 3.5, so they shouldn't require .NET 3.5.
 
Share this answer
 
Comments
axt_star 26-Oct-11 0:03am    
Thank you for teaching me the website.
axt_star 18-Nov-11 2:27am    
My sample app didn't work on another machine which didn't install the OPEN XML SDK2.

However I copied the DocumentFormat.OpenXml files into the machine at same place of my exe, it worked!!

This way is OK?

I will write sample code into Solution.
Andrew Rissing 18-Nov-11 9:43am    
Right, if you just copy those Dll's over and they have .NET 3.5 or greater, they should be able to use your executable.
axt_star 22-Nov-11 6:17am    
I'll do this way.
Thank you!
Here is my sample code of being able to create a xlsx file.
It worked on another machine which .NET4 only installed.
The point was copying the DocumentFormat.OpenXml files, which located at 'C:\Program Files\Open XML SDK\V2.0\lib', into the same directory of the sample app's exe.

C#
using System;
using System.IO;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;

using DocumentFormat.OpenXml.Packaging;
using DocumentFormat.OpenXml.Spreadsheet;
using DocumentFormat.OpenXml;


namespace WindowsFormsApplication1
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
        }

        private void button1_Click(object sender, EventArgs e)
        {
            String filepath = @"c:\2.xlsx";
            // Create a spreadsheet document by supplying the filepath.
            // By default, AutoSave = true, Editable = true, and Type = xlsx.
            SpreadsheetDocument spreadsheetDocument = SpreadsheetDocument.
                Create(filepath, SpreadsheetDocumentType.Workbook);

            // Add a WorkbookPart to the document.
            WorkbookPart workbookpart =spreadsheetDocument.AddWorkbookPart();
            workbookpart.Workbook = new Workbook();

            // Add a WorksheetPart to the WorkbookPart.
            WorksheetPart worksheetPart=workbookpart.AddNewPart<worksheetpart>();
            worksheetPart.Worksheet = new Worksheet(new SheetData());

            // Add Sheets to the Workbook.
            Sheets sheets = spreadsheetDocument.WorkbookPart.Workbook.
                AppendChild<sheets>(new Sheets());

            // Append a new worksheet and associate it with the workbook.
            Sheet sheet = new Sheet()
            {
                Id = spreadsheetDocument.WorkbookPart.
                    GetIdOfPart(worksheetPart),
                SheetId = 1,
                Name = "mySheet"
            };

            sheets.Append(sheet);

            workbookpart.Workbook.Save();

            // Close the document.
            spreadsheetDocument.Close();

            
        }

    }
}
</sheets></worksheetpart>
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900