List links in Excel file
Problem to adjust sheet
Hi,
How to adjust these
Using (SpreadsheetDocument spreadSheet = SpreadsheetDocument.Open(docName, true)) { SharedStringTablePart shareStringPart; if (spreadSheet.WorkbookPart.GetPartsOfType<SharedStringTablePart>().Count() > 0) { shareStringPart = spreadSheet.WorkbookPart.GetPartsOfType<SharedStringTablePart>().First(); } else { shareStringPart = spreadSheet.WorkbookPart.AddNewPart<SharedStringTablePart>(); } int index = InsertSharedStringItem(text, shareStringPart); WorksheetPart worksheetPart = InsertWorksheet(spreadSheet.WorkbookPart); Cell cell = InsertCellInWorksheet("A", 1, worksheetPart); cell.CellValue = new CellValue(index.ToString()); cell.DataType = new EnumValue<CellValues>(CellValues.SharedString); worksheetPart.Worksheet.Save(); }to put specific value into one cell of a selected sheet with a provided name?
Many Thanks & Best Regards, Hua Min
Get image alttext using openxml
I'm trying to find image in excel file(.xlsx) using openxml library. I'm able to find the image part But it won't have any property to access alternate text.
Embedding a Visio Object into a Word 2007 Document
Hi,
I'm trying to embed a Visio Object into a word document programmatically. I used the code generated by the Document Reflector, reflecting an existing template which has a visio object already embedded.
I see that the code embeds 2 elements, an image for representing the Visio object and the actual visio file.
First off: How do i embed the image for the visual representation of the Visio file with just a single .VSD file available to me?
Also, I tried embedding the VSD file and a sample image file for representing it. This unfortunately results in embedding of the image. i.e.
Word 2007 identifies the inserted object as an image and not as a Visio object. How do i work around this?
Any help would be appreciated.
Thank You
P.S I'm using an AddImagePart method for embedding the Visio Representation Image
and AddEmbeddedObjectPart method for embedding the actual Visio .VSD Object
Update: I tried changing the content type, this time however Word recognised the Embedded Object as an Unknown Object. It allowed me to activate the package only to display an error message stating "The Server Application Could not be Found". I played around with the different Content Types available for .VSD files, all of which threw the same error, except for "application/vnd.ms-visio.viewer", this however was recognised as an image.
Adding a shape to a presentation
I am trying to add a shape to a PowerPoint presentation via openxml, but my changes won't stick. Can somebody spot what I am doing wrong?
Here is my Code:
FileInformation fileInformation = ClientOM.File.OpenBinaryDirect(clientContext, (string)item["FileRef"]); using (MemoryStream memoryStream = new MemoryStream()) { CopyStream(fileInformation.Stream, memoryStream); using (PresentationDocument ppt = PresentationDocument.Open(memoryStream, true)) { string rId = GetSlidePart(ppt, 0); PresentationPart pptPart = ppt.PresentationPart; SlidePart slide = (SlidePart)pptPart.GetPartById(rId); Drwng.ShapeTypeValues shapeType = Drwng.ShapeTypeValues.Cloud; Slide sl = new Slide(); sl.Load(slide); Drwng.Shape shape = new Drwng.Shape(); [...setting all the properties of shape...] // Add Shape to Shapetree slide.Slide.CommonSlideData.ShapeTree.Append(shape.CloneNode(true)); pptPart.Presentation.Save(); } memoryStream.Seek(0, SeekOrigin.Begin); ClientOM.File.SaveBinaryDirect(clientContext, (string)item["FileRef"], memoryStream, true); }I can add the part where I set the shape settings but I thought it wasn't relevant and would only serve to blow up the amount of code.
Open Xml
Way to loop through Worksheet and copy cells' properties
Hi,
Further to this thread,
how about that I want to loop through all worksheets of the workbook and copy all other sheets into this "overall" sheet?BTW, to the current codes in that, how can I also copy the properties, like width, color, bold/italic, font, of each cell, within the Worksheets?
Many Thanks & Best Regards, Hua Min
Table header
Created Date and Time Insertion in Excel Sheet of core.
Hai all ,
I want to insert Created date and time in "core.xml" . i cannot use the excel functions i need to insert by code . my doubt is in what format it will store the data and time actually i am not understanding the date format .
<dcterms:created xsi:type="dcterms:W3CDTF">2006-09-16T00:00:00Z</dcterms:created><dcterms:modified xsi:type="dcterms:W3CDTF">2006-09-16T00:00:00Z</dcterms:modified>
so the format is '<date>T<time>z ' is this format what i am thing is correct or any specific meaning if so what.
and one more question , for newly created one why last modified is getting filled while last modified By is not getting filled
any specific reason for that also
Regards,
kiran rachamalla.
table
Problem to sheet type
How to resolve
Error 2 Cannot implicitly convert type 'Microsoft.Office.Interop.Excel.Sheets' to 'DocumentFormat.OpenXml.Spreadsheet.Worksheet'. An explicit conversion exists (are you missing a cast?) C:\App\WindowsFormsApplication8\WindowsFormsApplication2\Form1.cs 139 67 WindowsFormsApplication2
due to last line below?
private static WorksheetPart InsertWorksheet(WorkbookPart workbookPart) { // Add a new worksheet part to the workbook. WorksheetPart newWorksheetPart = workbookPart.AddNewPart<WorksheetPart>(); newWorksheetPart.Worksheet = new DocumentFormat.OpenXml.Spreadsheet.Worksheet(new SheetData()); newWorksheetPart.Worksheet.Save(); DocumentFormat.OpenXml.Spreadsheet.Worksheet sheets = workbookPart.Workbook.GetFirstChild<Sheets>();
Many Thanks & Best Regards, Hua Min
Getting the relationship ID of a shape via looking for their names (PowerPoint)
Hey there,
how can I get the relationship ID of a shape through their name? What I want to do is something like this:
public static String GetShapeRId (Slide slide, String name) { foreach (Shape shape in shapes) { if (shape.NonVisualShapeProperties.NonVisualDrawingProperties.Name == name) { return shape.RelationshipID; // This is the part I am looking for. } } return null; }I am quite new to C# and OpenXML so as always suggestions for code improvements would be appreciated as well.
find table
Regarding Sharedstring.xml
Hai all,
When i enter a content like '<some valeu>' in a cell i can see in sharedstring.xml file i can see
<si><t><lwa_ded></t></si>
that is < and > that was great and i understood the reason but my doubt is is there any other replacements in sharedstring.html like this i mean for any other symbols or etc.
Regards,
kiran rachamalla.
Use OpenXML for formatting in Microsoft Word with MergeFields
Hi Developers,
I've got a similar problem like Harish in here (https://social.msdn.microsoft.com/Forums/windowsapps/en-US/80203cdd-52a8-4a1e-94ad-66d89f756f4d/insert-merge-field-in-word-using-open-xml?forum=oxmlsdk). But since nobody answered it and the original poster isn't paying attention to that thread anymore I would like to open a new one.
What I want to do:
In our company we're using the workflow engine K2 blackpearl. With this engine it is possible to run custom codes and code snippets. We need to generate a Microsoft Word doc(/docx)-File with the possiblity to use a custom template. Because the interface is very rudimental I want to use HTML to format the text. Since Word isn't able to understand HTML I'm converting it to OpenXML and writing it into the document. My problem is that I want to insert the text at some defined places in the document (therefore I want to use Mergefields but I am open to use sth. different if so. suggests sth. better). Does anybody know how to do that?
I've tried methods that are suggested (https://vivekcek.wordpress.com/2012/08/25/create-a-word-document-from-a-template-using-c-mail-merge/) and use a converter which you can see here (https://html2openxml.codeplex.com/documentation).
Many thanks so far
Tim
How to read Equations from word/embeddings folder.
Hello Everyone,
I have a one word document where I have 100's of Equations. When I am opening the content, I have found that these Equations are basically embedded in the Word document at word/embeddings/oleObject1.bin. I need to get the equation content from these files. Please, let me know, how to get the content from these files programatically using C#. Here is the reference from document.xml
Thanks in advance,
<v:shape id="_x0000_i1033" type="#_x0000_t75" style="width:78pt;height:15pt" o:ole=""><v:imagedata r:id="rId9" o:title=""/></v:shape><o:OLEObject Type="Embed" ProgID="Equation.DSMT4" ShapeID="_x0000_i1033" DrawAspect="Content" ObjectID="_1532182555" r:id="rId10"/>
Shahab Abbasi
XLSX numFmtId predefined ID = 14 doesn't match
Hi;
Take a look at the file http://www.windwardreports.com/temp/Inventory%20Shrink%20-%20Template.xlsx in cell E2. This is set to numFmtId=14.
Excel displays it as 1/2/2003 but the OpenXML spec says it is mm-dd-yy. Any idea why they don't match?
thanks - dave
Very funny video - Reporting as a Metaphor
Copy Cell property
Is there one example to copy Cell Width, Cell's font size, to one other Worksheet, using OpenXML?
Many Thanks & Best Regards, Hua Min
How to find description of multiple tables in a single powerpoint file
Productivity Tool usability
The Open XML SDK 2.5 Productivity Tool does some amazing things for me, but it would be even better if there could be some way to automatically fill in the Browse Files to Compare dialog box, such as with the last files opened.
What I tried:
- Google search for: Open XML SDK Productivity Tool command line
- I used the Spy++ program that comes with Visual Studio. It only recognizes the dialog box, not the dialog box controls.
- I posted a question to github/OfficeDev/Open-XML-SDK
- I wrote the below program to find the dialog using EnumWindows(). I can find the dialog and move the control focus by sending it tab characters, but EnumChildWindows() doesn't find the dialog controls, and sending keystrokes to the dialog doesn't fill in the dialog controls.
Howard Rubin
BOOL CALLBACK EnumWindowsProc(HWND hwnd, LPARAM lParam); int _tmain(int argc, _TCHAR* argv[]) { EnumWindows(EnumWindowsProc, NULL); return 0; } using namespace std; BOOL CALLBACK EnumChildProc(HWND hwnd, LPARAM lParam) { wcout << hwnd << std::endl; return TRUE; } BOOL CALLBACK EnumWindowsProc(HWND hwnd, LPARAM lParam) { wchar_t title[1000]; GetWindowText(hwnd, title, sizeof(title)-1); if (!wcscmp(L"Browse Files to Compare", title)) { wcout << "Window title: " << title << endl; EnumChildWindows(hwnd, EnumChildProc, NULL); for (int i = 0; i < 2; ++i) { SendMessage(hwnd, WM_KEYDOWN, VK_TAB, 0); SendMessage(hwnd, WM_KEYUP, VK_TAB, 0); } //SendMessage(hwnd, WM_CLOSE, NULL, NULL); } return TRUE; }