Quantcast
Channel: Open XML Format SDK forum
Viewing all 1288 articles
Browse latest View live

SSRS 2012 EmailTo is not working in Export to Excel Format

$
0
0

Hi there,

I have a SSRS Report originally developed in 2005 and I have office 2013 installed in my computer. Any time I export this report to Excel format from SSRS 2005 report server (xls), "emailTo" function works and outlook will open form within excel file but any time I render this report from SSRS 2012 and export it to Excel format (xlsx), first hit, I receive a message from Excel side tells me some part of my file is not readable and get the confirmation if I want excel repair the part. by No Answer file will not open obviously, by Yes answer the email address (url) has replace with some local address. Within local I have a log file of what had happend as:

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
-<recoveryLog xmlns="http://schemas.openxmlformats.org/spreadsheetml/2006/main">
 <logFileName>error100640_01.xml</logFileName>
 <summary>Errors were detected in file 'C:\Users\xxxxx\AppData\Local\Microsoft\Windows\Temporary Internet Files\Content.IE5\5EZDN437\myReport[1].xlsx'</summary>
-<additionalInfo>
 <info>Excel completed file level validation and repair. Some parts of this workbook may have been repaired or discarded.</info>
 </additionalInfo>
-<repairedRecords summary="Following is a list of repairs:">
 <repairedRecord>Repaired Records: Drawing from /xl/drawings/drawing2.xml part (Drawing shape)</repairedRecord>
 </repairedRecords>
 </recoveryLog>

Any Work around or suggestion highly appreciated.


How do you add a standard format date Cell to an existing Excel Spreadsheet using OpenXML?

$
0
0

Hi,

I am trying to add a formatted date cell "m/d/yy" to an existing excel spreadsheet, but all I can get is the date number:

where "r" is new Row() and row.LeaseStartDate="yyyy-mm-dd"

r.AppendChild(new Cell() { CellReference = "D" + Convert.ToString(idx), CellValue = new CellValue(){Text = row.LeaseStartDate} ,DataType= CellValues.Date});

The correct information appears, but is is the ToOADate() number, not in dateformat. I have tried adding StyleIndex=1 with same results.

I am using Excel 2010/2013

Thank you

         

Paul


Convert a VSDX file (MS Visio 2013) to PDF in a C# module

$
0
0

Hi,

How do I create a PDF file from a C# module after manipulating the VSDX file in the module?

Thank you.


what's the difference between "ApplyFill=true" and "ApplyFill=false"

$
0
0

hi,

In the excel document,  the following three seems the same, what is the difference?

1) <xf numFmtId="0" fontId="0" fillId="2" borderId="0" xfId="0" applyFill="1">...  //CellFormat.ApplyFill=true

2) <xf numFmtId="0" fontId="0" fillId="2" borderId="0" xfId="0" >...                         //CellFormat.ApplyFill=null

3) <xf numFmtId="0" fontId="0" fillId="2" borderId="0" xfId="0" applyFill="0">...  //CellFormat.ApplyFill=false

thanks,

Jialinhai

How to edit a word document using Office Open XML ?

$
0
0

Hi,

I want to edit a word document using Office open xml. Can someone guide me through it.

Thanks

Jay


List indentation through style indirection

$
0
0

According to the description of numbered & bulleted lists, a w.p element can have a w.pStyleId element, which references a style that includes a w.num element that points to a w.abstractNumId.  In that case, you can determine what indentation level the w.p element is at by finding the w.ilvl element that has the same pStyleId value as was in the original w.pStyleId (simple, I know).

Here is where I found that description http://msdn.microsoft.com/en-us/library/office/ee922775(v=office.14).aspx#odc_Office14_ta_WorkingWithNumbering_MarkupLinkedToStyles

However, I have found a case where I can follow all of those steps and still end up with an indentation level that is different from what I observe by opening the document in Word.  Can someone explain what I'm missing here?

My document has a numbered list, where one of the list elements contains a bulleted sub-list.  I expected to see that the elements in the bulleted list would point to an indentation level of 1 (zero-based).  That's not what I saw and yet Word still seems to display the bulleted list at the proper indentation level.

Here is the Main Document element:

<w:p w:rsidR="00043DB5" w:rsidRPr="00233089" w:rsidRDefault="00043DB5" w:rsidP="00233089"><w:pPr><w:pStyle w:val="ListBullet2"/></w:pPr><w:r w:rsidRPr="00233089"><w:t>Thumbs up = agree with no further discussion.</w:t></w:r></w:p>

Here's the relevant style:

<w:style w:type="paragraph" w:styleId="ListBullet2"><w:name w:val="List Bullet 2"/><w:basedOn w:val="BodyText"/><w:rsid w:val="00233089"/><w:pPr><w:numPr><w:numId w:val="36"/></w:numPr><w:tabs><w:tab w:val="clear" w:pos="1620"/><w:tab w:val="num" w:pos="1080"/></w:tabs><w:spacing w:before="60" w:after="60"/><w:ind w:left="1080"/></w:pPr></w:style>

Here's the relevant num element:

<w:num w:numId="36"><w:abstractNumId w:val="24"/>

Here are the relevant parts of the abstractNum:

<w:abstractNum w:abstractNumId="24"><w:nsid w:val="426153D2"/><w:multiLevelType w:val="hybridMultilevel"/><w:tmpl w:val="85E2C95C"/><w:lvl w:ilvl="0" w:tplc="6A7461F6"><w:start w:val="1"/><w:numFmt w:val="bullet"/><w:pStyle w:val="ListBullet2"/><w:lvlText w:val=""/><w:lvlJc w:val="left"/><w:pPr><w:tabs><w:tab w:val="num" w:pos="1620"/></w:tabs><w:ind w:left="1620" w:hanging="360"/></w:pPr><w:rPr><w:rFonts w:ascii="Wingdings" w:hAnsi="Wingdings" w:hint="default"/></w:rPr></w:lvl><w:lvl w:ilvl="1" w:tplc="04090003" w:tentative="1"><w:start w:val="1"/><w:numFmt w:val="bullet"/><w:lvlText w:val="o"/><w:lvlJc w:val="left"/><w:pPr><w:tabs><w:tab w:val="num" w:pos="1440"/></w:tabs><w:ind w:left="1440" w:hanging="360"/></w:pPr><w:rPr><w:rFonts w:ascii="Courier New" w:hAnsi="Courier New" w:cs="Courier New" w:hint="default"/></w:rPr></w:lvl>

ListBullet2 is clearly in the element where ilvl is 0.  Is there some other way I should know that this bulleted list item is and the 2nd indentation level?  I can't seem to find any indication of it in this document XML.

Thanks for your help

 

Open XML - Create Document, Add Text to it, and Output using MemoryStream

$
0
0
I'm using the code below which creates a document and some sample text, except the sample text does not appear when I open the document.

Can anyone help me out here?

Thanks

    protected void cmdGenerate_Click(object sender, EventArgs e)
    {
        using (MemoryStream mem = new MemoryStream())
        {
            // Create Document
            using (WordprocessingDocument wordDocument = WordprocessingDocument.Create(mem,
            WordprocessingDocumentType.Document, true))
            {
                // Add a main document part.
                MainDocumentPart mainPart = wordDocument.AddMainDocumentPart();

                new Document(new Body()).Save(mainPart);

                // Assign a reference to the existing document body.
                Body body = mainPart.Document.Body;

                // Add new text.
                Paragraph para = body.AppendChild(new Paragraph());
                Run run = para.AppendChild(new Run());
                run.AppendChild(new Text("this is sample text"));

                mainPart.Document.Save();
                // Stream it down to the browser
                Response.AppendHeader("Content-Disposition", "attachment;filename=" + txtManufacturer.Text + ".docx");
                Response.ContentType = "application/vnd.openxmlformats-officedocument.wordprocessingml.document";
                mem.CopyTo(Response.OutputStream);
                wordDocument.Close();
                Response.End();
            }

        }
}



get an error after updating the core properties

$
0
0

Hello,

I have just started using Open XML and I am trying to do something really simple to get and set the core properties of a document. I am using the following code

   public static void getProps(String fileName)
        {
            WordprocessingDocument document = null;
            try
            {
                document = WordprocessingDocument.Open(fileName, false);
                var docProps = document.PackageProperties;
                Console.WriteLine("Category " + docProps.Category);
                Console.WriteLine("ContentStatus " + docProps.ContentStatus);
                Console.WriteLine("ContentType " + docProps.ContentType);
                Console.WriteLine("Created " + docProps.Created);
                Console.WriteLine("Creator " + docProps.Creator);
                Console.WriteLine("Description " + docProps.Description);
                Console.WriteLine("Identifier " + docProps.Identifier);
                Console.WriteLine("Keywords " + docProps.Keywords);
                Console.WriteLine("Language " + docProps.Language);
                Console.WriteLine("LastModifiedBy " + docProps.LastModifiedBy);
                Console.WriteLine("LastPrinted " + docProps.LastPrinted);
                Console.WriteLine("Modified " + docProps.Modified);
                Console.WriteLine("Revision " + docProps.Revision);
                Console.WriteLine("Subject " + docProps.Subject);
                Console.WriteLine("Title " + docProps.Title);
                Console.WriteLine("Version " + docProps.Version);
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex.Message);
            }
            finally
            {
                document.Close();
            }
        }

and

  public static void setProps(String fileName)
        {
            WordprocessingDocument document = null;
            try
            {
                document = WordprocessingDocument.Open(fileName, true);

                var docProps = document.PackageProperties;
                docProps.Category = "test21";
                docProps.ContentStatus = "test21";
                docProps.ContentType = "test21";
                docProps.Created = DateTime.Now;
                docProps.Creator = "test21";
                docProps.Description = "test21";
                docProps.Identifier = "test21";
                docProps.Keywords = "test21";
                docProps.Language = "test21";
                docProps.LastModifiedBy = "test21";
                docProps.LastPrinted = DateTime.Now;
                docProps.Modified = DateTime.Now;
                docProps.Revision = "test21";
                docProps.Subject = "test21";
                docProps.Title = "test21";
                docProps.Version = "test21";
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex.Message);
            }
            finally
            {
                document.Close();
            }
        }

after I call the setProps if I try to open the word document with word I will get an error that says

file xxx.docx cannot be opened because there is a problem with the contents

and then tells me that it has found some unreadable context and if I would like restore the document.

could someone tell me what I am doing wrong? and why this is happening.

cheers,

Ehsan 


copy existing worksheet from workbook and insert it in anthor workbook using c# and open xml.

$
0
0

Hi,

I need to copy existing worksheet from workbook and insert it in anthor workbook using c# and open xml.

It's work for integer value but not for string.

and when i add  this line   SharedStringTablePart newSharedStringTable = newWorkbookPart.AddPart<SharedStringTablePart>(sharedStringTable);

i have erro message open one instance of the type is allowed for this parent

any ideas???

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.IO;
using System.Reflection;
using DocumentFormat.OpenXml;
using DocumentFormat.OpenXml.Packaging;
using DocumentFormat.OpenXml.Spreadsheet;

namespace CopySheetToNewWorkbook
{
    class Program
    {

       static int tableId = 0;

        static void Main(string[] args)
        {
            string filename = @"C:\Test\workfileTestCopySheet.xlsx";
            File.Copy(@"C:\Test\TestCopySheet.xlsx", filename, true);
            CopySheet(filenamesource, filenameTarget, "sheet1");
        }

        static WorksheetPart GetWorkSheetPart(WorkbookPart workbookPart, string sheetName)
        {
            //Get the relationship id of the sheetname
            string relId = workbookPart.Workbook.Descendants<Sheet>()
                .Where(s => s.Name.Value.Equals(sheetName))
                .First()
                .Id;

            return (WorksheetPart)workbookPart.GetPartById(relId);
        }

        static void CopySheet(string filename, string TargetfileName, string sheetName)
        {

               //Open workbook
            using (SpreadsheetDocument mySpreadsheet = SpreadsheetDocument.Open(filename, true))
            {
                WorkbookPart workbookPart = mySpreadsheet.WorkbookPart;
                //Get the source sheet to be copied
                WorksheetPart sourceSheetPart = GetWorkSheetPart(workbookPart, sheetName);
SharedStringTablePart sharedStringTable = workbookPart.SharedStringTablePart;
                //Take advantage of AddPart for deep cloning
                using (SpreadsheetDocument newXLFile = SpreadsheetDocument.Create(TargetfileName, mySpreadsheet.DocumentType))
                {
                    WorkbookPart newWorkbookPart = newXLFile.AddWorkbookPart();
                    SharedStringTablePart newSharedStringTable = newWorkbookPart.AddPart<SharedStringTablePart>(sharedStringTable);
                    WorksheetPart newWorksheetPart = newWorkbookPart.AddPart<WorksheetPart>(sourceSheetPart);
                    //Table definition parts are somewhat special and need unique ids...so let's make an id based on count
                    int numTableDefParts = sourceSheetPart.GetPartsCountOfType<TableDefinitionPart>();
                    tableId = numTableDefParts;

                    //Clean up table definition parts (tables need unique ids)
                    if (numTableDefParts != 0)
                        FixupTableParts(newWorksheetPart, numTableDefParts);
                    //There should only be one sheet that has focus
                    CleanView(newWorksheetPart);

                    var fileVersion = new FileVersion { ApplicationName = "Microsoft Office Excel" };

                    //Worksheet ws = newWorksheetPart.Worksheet;
                    Workbook wb = new Workbook();
                    wb.Append(fileVersion);

                    //Add new sheet to main workbook part
                    Sheets sheets = null;
                    //int sheetCount = wb.Sheets.Count();
                    if (wb.Sheets != null)
                    { sheets = wb.GetFirstChild<Sheets>(); }
                    else
                    { sheets = new Sheets(); }

                    Sheet copiedSheet = new Sheet();
                    copiedSheet.Name = SheetName;
                    copiedSheet.Id = newWorkbookPart.GetIdOfPart(newWorksheetPart);
                    if (wb.Sheets != null)
                    { copiedSheet.SheetId = (uint)sheets.ChildElements.Count + 1; }
                    else { copiedSheet.SheetId = 1; }

                    sheets.Append(copiedSheet);
                    newWorksheetPart.Worksheet.Save();

                    wb.Append(sheets);
                    //Save Changes
                    newWorkbookPart.Workbook = wb;
                    wb.Save();
                    newXLFile.Close();
                }
            }
        }

        static void CleanView(WorksheetPart worksheetPart)
        {
            //There can only be one sheet that has focus
            SheetViews views = worksheetPart.Worksheet.GetFirstChild<SheetViews>();

            if (views != null)
            {
                views.Remove();
                worksheetPart.Worksheet.Save();
            }
        }

        static void FixupTableParts(WorksheetPart worksheetPart, int numTableDefParts)
        {
            //Every table needs a unique id and name
            foreach (TableDefinitionPart tableDefPart in worksheetPart.TableDefinitionParts)
            {
                tableId++;
                tableDefPart.Table.Id = (uint)tableId;
                tableDefPart.Table.DisplayName = "CopiedTable" + tableId;
                tableDefPart.Table.Name = "CopiedTable" + tableId;
                tableDefPart.Table.Save();
            }
        }
    }
}

                                                             

Open Xml Skip Empty Header Rows

$
0
0

The Excel data row starts on the 4th row.  After opening the worksheet, it supposed to skip the first 3 header rows.  If the first 3 rows have data each row, it works fine.  If the first 2 rows are empty, it skips the first header row and 2 data rows and start getting data from the 6th row.  How can I have it start getting data from the 4th row regardless?

Thanks.

doubt in open xml sdk and office

$
0
0

hi,

I am implementing a solution with openxml wit sharepoint. i am uploading docs into sharepoint document library and parsing the  excel files with the help of open xml . so i have  installed open xml sdk ms office in my dev env.

my  question is , should i install ms office and, open xml sdk in the staging and PROD servers also for working with these files?


Das

Setting Column Widths Corrupts Spreadsheet

$
0
0

I'm working with Open XML for the first time and I am astonished at how complicated it is.  The Excel object model was complicated, but it seems simple by comparison.  I'm about ready to give up and look for a different solution, but I'll try posting this question here and see if I can get any simple answers. 

I have an ASP.NET MVC web page and I want to let my user download a spreadsheet with data from the database.  I can get some data to appear in the downloaded spreadsheet, but when I tried to set the column widths in Open XML it started given me file validation errors and none of the data appears, and the column widths are not set.  It's just a blank spreadsheet.  This is the error it displays:

Excel completed file level validation and repair. Some parts of this workbook may have been repaired or discarded.
Replaced Part: /xl/worksheets/sheet.xml part with XML error.  Load error. Line 1, column 211.

Here is the test code that has only one cell loaded with the value Test 4.  It appears when I don't load the Columns object.  It disappears with this error when I try to load the Columns object.  Here is my code:

        private void CreatePartsTest()
        {
            document = SpreadsheetDocument.Create(moMemoryStream, SpreadsheetDocumentType.Workbook);
            WorkbookPart workbookPart = document.AddWorkbookPart();
            Workbook workbook = new Workbook();
            workbookPart.Workbook = workbook;
            WorkbookStylesPart workbookStylesPart = workbookPart.AddNewPart<WorkbookStylesPart>("rIdStyles");
            Stylesheet stylesheet = new Stylesheet();
            workbookStylesPart.Stylesheet = stylesheet;
            WorksheetPart worksheetPart = workbookPart.AddNewPart<WorksheetPart>("TestID");
            Worksheet worksheet = new Worksheet();

            Columns cs = new Columns();
            Column c = new Column()
            {
                Min = (UInt32Value)1U,
                Max = (UInt32Value)1U,
                Width = 44.33203125D,
                CustomWidth = true
            };
            cs.Append(c);
            //worksheetPart.Worksheet.Append(cs);
            worksheet.Append(cs);

            // LoadColumns(ref worksheet, oGridColumns);
            //worksheet.Append(new Columns(new Column() { Min = (uint)1U, Max = (uint)1U, Width = 24 }));
            SheetViews sheetViews = new SheetViews();
            SheetView sheetView = new SheetView() { TabSelected = true, WorkbookViewId = (UInt32Value)0U };
            sheetViews.Append(sheetView);
            SheetData sheetData1 = new SheetData();
            Row row1 = new Row() { RowIndex = (UInt32Value)1U };
            sheetData1.Append(row1);
            worksheet.Append(sheetViews);
            worksheet.Append(sheetData1);
            worksheetPart.Worksheet = worksheet;

            Sheet sheet = new Sheet();
            sheet.Name = "Test";
            sheet.SheetId = (uint)1;
            sheet.Id = "TestID";
            Sheets sheets = new Sheets();
            sheets.Append(sheet);
            workbook.Append(sheets);

            //oSpreadSheet.WorkbookPart.Workbook.Save();
            wbPart = document.WorkbookPart;
        }


MCSD .NET developer in Dallas, Texas

Setting Column Widths Corrupts Spreadsheet

$
0
0

I'm working with Open XML for the first time and I am astonished at how complicated it is.  The Excel object model was complicated, but it seems simple by comparison.  I'm about ready to give up and look for a different solution, but I'll try posting this question here and see if I can get any simple answers. 

I have an ASP.NET MVC web page and I want to let my user download a spreadsheet with data from the database.  I can get some data to appear in the downloaded spreadsheet, but when I tried to set the column widths in Open XML it started given me file validation errors and none of the data appears, and the column widths are not set.  It's just a blank spreadsheet.  This is the error it displays:

Excel completed file level validation and repair. Some parts of this workbook may have been repaired or discarded.
Replaced Part: /xl/worksheets/sheet.xml part with XML error.  Load error. Line 1, column 211.

Here is my test code:

        private void CreatePartsTest()
        {
            document = SpreadsheetDocument.Create(moMemoryStream, SpreadsheetDocumentType.Workbook);
            WorkbookPart workbookPart = document.AddWorkbookPart();
            Workbook workbook = new Workbook();
            workbookPart.Workbook = workbook;
            WorkbookStylesPart workbookStylesPart = workbookPart.AddNewPart<WorkbookStylesPart>("rIdStyles");
            Stylesheet stylesheet = new Stylesheet();
            workbookStylesPart.Stylesheet = stylesheet;
            WorksheetPart worksheetPart = workbookPart.AddNewPart<WorksheetPart>("TestID");
            Worksheet worksheet = new Worksheet();

            Columns cs = new Columns();
            Column c = new Column()
            {
                Min = (UInt32Value)1U,
                Max = (UInt32Value)1U,
                Width = 44.33203125D,
                CustomWidth = true
            };
            cs.Append(c);
            //worksheetPart.Worksheet.Append(cs);
            worksheet.Append(cs);

            // LoadColumns(ref worksheet, oGridColumns);
            //worksheet.Append(new Columns(new Column() { Min = (uint)1U, Max = (uint)1U, Width = 24 }));
            SheetViews sheetViews = new SheetViews();
            SheetView sheetView = new SheetView() { TabSelected = true, WorkbookViewId = (UInt32Value)0U };
            sheetViews.Append(sheetView);
            SheetData sheetData1 = new SheetData();
            Row row1 = new Row() { RowIndex = (UInt32Value)1U };
            sheetData1.Append(row1);
            worksheet.Append(sheetViews);
            worksheet.Append(sheetData1);
            worksheetPart.Worksheet = worksheet;

            Sheet sheet = new Sheet();
            sheet.Name = "Test";
            sheet.SheetId = (uint)1;
            sheet.Id = "TestID";
            Sheets sheets = new Sheets();
            sheets.Append(sheet);
            workbook.Append(sheets);

            //oSpreadSheet.WorkbookPart.Workbook.Save();
            wbPart = document.WorkbookPart;
        }


MCSD .NET developer in Dallas, Texas


assembly culture - "en" and "en-us", is it different assemblies?

$
0
0

Hi!!!

Assembly may have culture simple "en" or "en-US". So, it must be different assemblies?

How it should be specified?

I mean that if I have a custom application with resource assembly culture "en", but user has culture "en-GB", what's happened?Is it will be assembly not found error exception?

Hope you understand my question)))

How to open an existing Excel worksheet and set column width to best fit Using openXML SAX in C# ?

$
0
0

How to open an existing Excel worksheet and set column width to best fit Using openXML SAX in C# ?  I need to iterate the columns to set them to best fit.

I found many examples online to set the column width when creating the column but not for existing.

Thanks.

Danyeung


How to save a selected word image to image file in open XML in PNG format?

$
0
0

Hi Everyone,

I have a very strange problem. I want to extract the image from word using open xml sdk. Here the user selects the image on opened word, and then clicks on any button, so it should extract the same selected image to any predefined location in the PNG format.

I also tried to do the same thing using Word API, there I am copying the selection of image to clipboard and then getting the image and converting it to bitmap and saving it, but the image resolution is coming very bad. Is there any method through which I can save the image to file either by Open XML sdk or Word API using C#.

Thanks,


Shahab Abbasi

Delete a column using OpenXML for EXCEL

$
0
0
a column is deleted,but there still a blank column, how to delete the blank column? 

How To Add Option Buttons To Spreadsheet.

$
0
0

I have created a process in C# that exports data to an Excel spreadsheet using Open XML.  It is working.  I want to add options buttons to the spreadsheet, but I can't find any information online on how to do this.  So I created a simple spreadsheet with an option button on it.  I then opened that spreadsheet in the Open XML SDK Productivity Tool.  I copied the generated code into my process and ran it.  It created an identical spreadsheet successfully.  Now I need to extract the code that created the option button, parameterize it, then call it multiple times in my project to load option buttons into my existing process.

I extracted the code shown below exactly from the generated code without change.  I call it with this code in my process:

SpreadsheetDocumentoSpreadsheet =CreateWorkbook(oMemoryStream, sSpreadsheetName, sFilePath);

AddWorksheet(oSpreadsheet, sSpreadsheetName, oColumns);

WorksheetoWorksheet = oSpreadsheet.WorkbookPart.WorksheetParts.First().Worksheet;

AddOptionButton(refoWorksheet,"OptionID1","Test Text");

When I open the spreadsheet it says that unreadable code was detected.  When I open the spreadsheet it appears normal, with my other content, but no option button.  It also says "Excel completed file level validation and repair. Some parts of this workbook may have been repaired or discarded".  Can anyone tell me how to correct this error?

        public static void AddOptionButton(ref SpreadsheetXML.Worksheet oWorksheet, string sControlID, string sButtonText)
        {
            AlternateContent alternateContent1 = new AlternateContent();
            alternateContent1.AddNamespaceDeclaration("mc", "http://schemas.openxmlformats.org/markup-compatibility/2006");
            AlternateContentChoice alternateContentChoice1 = new AlternateContentChoice() { Requires = "x14" };
            AlternateContent alternateContent2 = new AlternateContent();
            alternateContent2.AddNamespaceDeclaration("mc", "http://schemas.openxmlformats.org/markup-compatibility/2006");
            AlternateContentChoice alternateContentChoice2 = new AlternateContentChoice() { Requires = "x14" };

            Controls controls1 = new Controls();
            Control control1 = new Control() { ShapeId = (UInt32Value)1027U, Id = sControlID, Name = sButtonText };
            ControlProperties controlProperties1 = new ControlProperties() { DefaultSize = false, AutoFill = false, AutoLine = false, AutoPict = false };

            FromMarker fromMarker1 = new FromMarker();
            Xdr.ColumnId columnId1 = new Xdr.ColumnId();
            columnId1.Text = "1";
            Xdr.ColumnOffset columnOffset1 = new Xdr.ColumnOffset();
            columnOffset1.Text = "409575";
            Xdr.RowId rowId1 = new Xdr.RowId();
            rowId1.Text = "1";
            Xdr.RowOffset rowOffset1 = new Xdr.RowOffset();
            rowOffset1.Text = "76200";

            fromMarker1.Append(columnId1);
            fromMarker1.Append(columnOffset1);
            fromMarker1.Append(rowId1);
            fromMarker1.Append(rowOffset1);

            ToMarker toMarker1 = new ToMarker();
            Xdr.ColumnId columnId2 = new Xdr.ColumnId();
            columnId2.Text = "3";
            Xdr.ColumnOffset columnOffset2 = new Xdr.ColumnOffset();
            columnOffset2.Text = "133350";
            Xdr.RowId rowId2 = new Xdr.RowId();
            rowId2.Text = "2";
            Xdr.RowOffset rowOffset2 = new Xdr.RowOffset();
            rowOffset2.Text = "95250";

            toMarker1.Append(columnId2);
            toMarker1.Append(columnOffset2);
            toMarker1.Append(rowId2);
            toMarker1.Append(rowOffset2);

            ObjectAnchor objectAnchor1 = new ObjectAnchor() { MoveWithCells = true };
            objectAnchor1.Append(fromMarker1);
            objectAnchor1.Append(toMarker1);

            controlProperties1.Append(objectAnchor1);
            control1.Append(controlProperties1);
            alternateContentChoice2.Append(control1);
            alternateContent2.Append(alternateContentChoice2);
            controls1.Append(alternateContent2);
            alternateContentChoice1.Append(controls1);
            alternateContent1.Append(alternateContentChoice1);

            oWorksheet.Append(alternateContent1);
        }


MCSD .NET developer in Dallas, Texas

How to insert images into Excel document using OpenXML 2.0 SDK

$
0
0
Can anyone help me?I can insert an image into Excel cell,but now, I want to insert mutiple images into Excel .Can anyone show C# codes?

Writing to multiple PackagePart streams causes deadlock. Is this fixed? kb951731

$
0
0

We are trying to use OpenXML to create Excel spreadsheets from a database and we are running into this documented problem (kb951731) when excels are above a certain size.

What is the status of this bug? Is it fixed in a later version of .net? We are using .net 4.5

Are there any ways to work around it when using OpenXML?


James.

Viewing all 1288 articles
Browse latest View live