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

Unable to find the Offset and Extents values

$
0
0
  A.TransformGroup transformGroup2 = new A.TransformGroup();
            A.Offset offset2 = new A.Offset() { X = 2002951L, Y = 646866L };
            A.Extents extents2 = new A.Extents() { Cx = 1052545L, Cy = 1055542L };

I want to design the pie shape in PPT by using open XML using .net. I used Open XML SDK Productivity tool to get the code.

In the above code how the 2002951L, 646566L, 1052545L, 1055542L calculated


Problem to access

$
0
0
Hi,
I get this error and Stacktrace like

Error: Access to the path 'C:\dp13' is denied. Stacktrace    at System.IO.__Error.WinIOError(Int32 errorCode, String maybeFullPath)
   at System.IO.FileStream.Init(String path, FileMode mode, FileAccess access, Int32 rights, Boolean useRights, FileShare share, Int32 bufferSize, FileOptions options, SECURITY_ATTRIBUTES secAttrs, String msgPath, Boolean bFromProxy, Boolean useLongPath, Boolean checkHost)
   at System.IO.FileStream..ctor(String path, FileMode mode, FileAccess access, FileShare share, Int32 bufferSize, FileOptions options, String msgPath, Boolean bFromProxy)
   at System.IO.FileStream..ctor(String path, FileMode mode, FileAccess access, FileShare share, Int32 bufferSize, Boolean useAsync)
   at MS.Internal.IO.Zip.ZipArchive.OpenOnFile(String path, FileMode mode, FileAccess access, FileShare share, Boolean streaming)
   at System.IO.Packaging.ZipPackage..ctor(String path, FileMode mode, FileAccess access, FileShare share, Boolean streaming)
   at System.IO.Packaging.Package.Open(String path, FileMode packageMode, FileAccess packageAccess, FileShare packageShare, Boolean streaming)
   at System.IO.Packaging.Package.Open(String path, FileMode packageMode, FileAccess packageAccess, FileShare packageShare)
   at DocumentFormat.OpenXml.Packaging.OpenXmlPackage.CreateCore(String path)
   at DocumentFormat.OpenXml.Packaging.SpreadsheetDocument.Create(String path, SpreadsheetDocumentType type, Boolean autoSave)
   at DocumentFormat.OpenXml.Packaging.SpreadsheetDocument.Create(String path, SpreadsheetDocumentType type)
   at WindowsFormsApplication2.Form1.CreateSpreadsheetWorkbook(String filepath, String SheetName0) in c:\App\WindowsFormsApplication9_4_0\WindowsFormsApplication2\Form1.cs:line 387


due to last line below. Why?
        public static void CreateSpreadsheetWorkbook(string filepath,string SheetName0)
        {
            try
            {
                // Create a spreadsheet document by supplying the filepath.
                // By default, AutoSave = true, Editable = true, and Type = xlsx.
                SpreadsheetDocument spreadsheetDocument = SpreadsheetDocument.
                    Create(filepath, SpreadsheetDocumentType.Workbook);



Many Thanks & Best Regards, Hua Min

Change Sheet tab color of excel file using Open XML

$
0
0

Hi,

I want to change the sheet tab color of an excel Xlsx  document. I am using the following code but it does not set the sheet color. I get object reference exception when I set the sheet tab color.

publicstaticstring filepath =@"C:\Test\Book1.xlsx";privatestaticvoidChangeSheetcolor(){try{using(SpreadsheetDocument spreadSheetDocument =SpreadsheetDocument.Open(filepath,false)){WorkbookPart workbookPart = spreadSheetDocument.WorkbookPart;IEnumerable<Sheet> sheets = spreadSheetDocument.WorkbookPart.Workbook.GetFirstChild<Sheets>().Elements<Sheet>();//my codeWorksheetPart worksheetPart =GetWorksheetPartByName(spreadSheetDocument,"Sheet1");if(worksheetPart !=null){//   worksheetPart.Worksheet.SheetProperties.TabColor.Rgb = DocumentFormat.OpenXml.HexBinaryValue.FromString("Red");
                        worksheetPart.Worksheet.SheetProperties.TabColor.Rgb=DocumentFormat.OpenXml.HexBinaryValue.FromString("#CCCCCC");// Save the worksheet.
                        worksheetPart.Worksheet.Save();}}}catch(Exception ex){}}privatestaticWorksheetPartGetWorksheetPartByName(SpreadsheetDocument document,string sheetName){IEnumerable<Sheet> sheets =
               document.WorkbookPart.Workbook.GetFirstChild<Sheets>().Elements<Sheet>().Where(s => s.Name== sheetName);if(sheets.Count()==0){//does not existreturnnull;}string relationshipId = sheets.First().Id.Value;WorksheetPart worksheetPart =(WorksheetPart)
                 document.WorkbookPart.GetPartById(relationshipId);return worksheetPart;}

How to change the sheet tab color using Open XML dlls.

Thanks

Ashok

Unable to properly format bibliographic citation (Same authors conditional handling)

$
0
0

I am attempting to modify the CHICAGO.XSL bibliographic style to conform with the 16th edition of the Chicago Manual of Style. I have been able to make a number of tweaks and get things closer, however, I have been unable to solve the following issue. If I have two references in a single in-text citation that are from the same author but have different dates, then the correct citation is

(Author Year1, Year2)

However, currently the CHICAGO.XSL style will do this:

(Author, Title Year1, Author, Title Year2)

I have been able to figure out how to remove the spurious Title information, but I have not been able to get Word to remove the Author name from the second, but not the first citation. In a more complicated citation I may have the following:

(Author1 Year 1; Author2 Year2.1, Year2.2; Author3 Year3)

Notice the use of semicolons here (I fixed this already) and the use of the Authors for everything but the third reference.

Now, this functionality is supported in the References section, because the XML object being processed contains all of the sources, and so you can use position() and indexing to look at the previous and next authors and determine whether they are the same as the current author or not. If they are, then you can do something different. However, the logic for the b:Citation part of the template isn't the same, as the b:Citation as far as I can tell will give only a single citation element, not all of the citation elements. This means that there is not an obvious way to compare authors. There is the b:Citation/b:RepeatedAuthor variable that is accessible, but this only indicates whether the given citation has an author that is a repeated author, and does not indicate whether or not you are the first reference of a set of repeated author references, or whether you are the second, third, and so on. What I really need is something like b:Citation/b:AuthorMatchesPreviousAuthor so that I can do something different with the subsequent repeated author citations.

I can hack part of this manually without editing the XSL file by simply manually editing the citation field to insert some strategic \n flags, but this actually doesn't solve the problem, because I need to use a comma to separate the dates of the references that share a common author, but a semicolon to separate the references that have different authors. I cannot modify the punctuation manually in the field, so I need another solution.

I am trying to figure out how to do this, but I cannot find a single reference to the b:Citation XML object and how I might work with it, nor can I find any generation information at all on how to work with Bibliography styles other than some obvious intro stuff. I need to know the actual tree structure I'm working with so that my XSLT makes sense, but I can't find a reference anywhere for how to do this.

Can someone help?

Problem to event

$
0
0
Hi,
I encounter this
Error	8	The best overloaded method match for 'WindowsFormsApplication2.Form1.InsertWorksheet(string)' has some invalid arguments	C:\App\WindowsFormsApplication9_4_0_1\WindowsFormsApplication2\Form1.cs	468	47	WindowsFormsApplication2


due to last line below
        public static void InsertWorksheet(string docName)
        {
            // Open the document for editing.
            using (SpreadsheetDocument spreadSheet = SpreadsheetDocument.Open(docName, true))
            {
                // Add a blank WorksheetPart.
                WorksheetPart newWorksheetPart = spreadSheet.WorkbookPart.AddNewPart<WorksheetPart>();
                newWorksheetPart.Worksheet = new DocumentFormat.OpenXml.Spreadsheet.Worksheet(new SheetData());

                //DocumentFormat.OpenXml.Spreadsheet.Worksheet sheets = spreadSheet.WorkbookPart.Workbook.GetFirstChild<Sheets>();
                DocumentFormat.OpenXml.Spreadsheet.Sheets sheets = spreadSheet.WorkbookPart.Workbook.GetFirstChild<DocumentFormat.OpenXml.Spreadsheet.Sheets>();
                string relationshipId = spreadSheet.WorkbookPart.GetIdOfPart(newWorksheetPart);

                // Get a unique ID for the new worksheet.
                uint sheetId = 1;
                if (sheets.Elements<Sheet>().Count() > 0)
                {
                    sheetId = sheets.Elements<Sheet>().Select(s => s.SheetId.Value).Max() + 1;
                }

                // Give the new worksheet a name.
                string sheetName = "Sheet Overall";

                // Append the new worksheet and associate it with the workbook.
                Sheet sheet = new Sheet() { Id = relationshipId, SheetId = sheetId, Name = sheetName };
                sheets.Append(sheet);
            }
        }
        public static void InsertText(string docName, string text)
        {
            // Open the document for editing.
            using (SpreadsheetDocument spreadSheet = SpreadsheetDocument.Open(docName, true))
            {
                // Get the SharedStringTablePart. If it does not exist, create a new one.
                SharedStringTablePart shareStringPart;
                if (spreadSheet.WorkbookPart.GetPartsOfType<SharedStringTablePart>().Count() > 0)
                {
                    shareStringPart = spreadSheet.WorkbookPart.GetPartsOfType<SharedStringTablePart>().First();
                }
                else
                {
                    shareStringPart = spreadSheet.WorkbookPart.AddNewPart<SharedStringTablePart>();
                }

                // Insert the text into the SharedStringTablePart.
                int index = InsertSharedStringItem(text, shareStringPart);

                // Insert a new worksheet.
                WorksheetPart worksheetPart = InsertWorksheet(spreadSheet.WorkbookPart);
                ...


while the codes are from this. Why?


Many Thanks & Best Regards, Hua Min


Still having troubles getting unused relationship IDs

$
0
0

Hi all,


I already posted a while ago with basically the same problem. I am trying to add a shape with a hyperlink to an existing presentation. Therefore I have to give the shape a static relationship ID (rID) since Office will otherwise complain that the shape is corrupted and will therefor remove it before opening the presentation.

To redeem this problem I loop through all the existing IDs on the slides, get the highest of them and add to it:


List<int> IDList = new List<int>(); foreach (Shape ShapeID in slide.Slide.Descendants<Shape>()) {

IDList.Add(int.Parse(ShapeID.NonVisualShapeProperties.NonVisualDrawingProperties.Id)); } return IDList.Max() + 1;

Apperently, these ID do not include the Hyperlink IDs which are given to Hyperlinks. The only way I found to get these rIDs is to store them as strings, convert them to integers and then get the highest of those (seems kind of complicated in hindsight, but there you are):


List<string> ret = new List<string>();
List<int> ids = new List<int>();
IEnumerable<Drwng.HyperlinkType> links = slide.Slide.Descendants<Drwng.HyperlinkType>();
// Iterate through all the links in the slide part.
foreach (Drwng.HyperlinkType link in links)
{
	// Iterate through all the external relationships in the slide part.
	foreach (HyperlinkRelationship relation in slide.HyperlinkRelationships)
	{
		ret.Add(relation.Id);
	}
		}
for (int i = 0; i < ret.Count; i++)
{
	ret[i] = Regex.Replace(ret[ret.Count - 1], "^[a-zA-Z]*", "");
	ids.Add(int.Parse(ret[i]));
}
if (ids.Count() > 0)
{
	maxID = ids.Max();
}
else
{
	maxID = 0;
}

Then I added these two numbers up, reasoning that the resulting number has to be the highest existing number. For the case, that there were no Hyperlinks on the slide I added 1 again. Just to be safe. This construct worked fine for a while. But today it threw me an exception because the ID already existed:

Does anyone know what I am doing wrong or an alternative way to check for used rIDs?

Cheers


Update cell value

$
0
0
Hi,
I want to put text into one cell, while I know Cell reference is like B2. How to adjust this

 public static void InsertText(string docName, string text)
{
    // Open the document for editing.
    using (SpreadsheetDocument spreadSheet = SpreadsheetDocument.Open(docName, true))
    {
        // Get the SharedStringTablePart. If it does not exist, create a new one.
        SharedStringTablePart shareStringPart;
        if (spreadSheet.WorkbookPart.GetPartsOfType<SharedStringTablePart>().Count() > 0)
        {
            shareStringPart = spreadSheet.WorkbookPart.GetPartsOfType<SharedStringTablePart>().First();
        }
        else
        {
            shareStringPart = spreadSheet.WorkbookPart.AddNewPart<SharedStringTablePart>();
        }

        // Insert the text into the SharedStringTablePart.
        int index = InsertSharedStringItem(text, shareStringPart);

        // Insert a new worksheet.
        WorksheetPart worksheetPart = InsertWorksheet(spreadSheet.WorkbookPart);

        // Insert cell A1 into the new worksheet.
        Cell cell = InsertCellInWorksheet("A", 1, worksheetPart);

        // Set the value of cell A1.
        cell.CellValue = new CellValue(index.ToString());
        cell.DataType = new EnumValue<CellValues>(CellValues.SharedString);

        // Save the new worksheet.
        worksheetPart.Worksheet.Save();
    }
}



that is from this URL, to update specific cell to given value?

Many Thanks & Best Regards, Hua Min

Create doughnut chart using openxml

$
0
0
I want to create doughnut chart using openxml, c# in power point. I have got code to create pie chart. Any one can help me out in creating doughnut chart

Need help on numbered list

$
0
0

Hello,

We encountered a problem with starting number in numbered lists in docx. The files are generated using SDK, and they have the same contents, same number list definition and references etc, but in Word they are displayed with different numbered list. I attached two files and the difference is on page 7, section u. The numbering should start witha., but in the bad.docx it started with d..Using SDK tool to compare the two files, they are identical except the generated IDs.  Please follow the link to see the good and bad docx: https://1drv.ms/f/s!ADUr3iXwsFDZgQM

Can some one help checking what we are missing?

Thanks in advance.

Harry

Try to create a Line shape using open XML

$
0
0

I am trying to design line shape using open xml .net API in PPT, but it is not getting rendered.

Below is the code block.

ConnectionShape connectionShape1 = new ConnectionShape();

            NonVisualConnectionShapeProperties nonVisualConnectionShapeProperties1 = new NonVisualConnectionShapeProperties();
            NonVisualDrawingProperties nonVisualDrawingProperties19 = new NonVisualDrawingProperties() { Id = this.shapeId, Name = this.shapeName };
            NonVisualConnectorShapeDrawingProperties nonVisualConnectorShapeDrawingProperties1 = new NonVisualConnectorShapeDrawingProperties();
            ApplicationNonVisualDrawingProperties applicationNonVisualDrawingProperties19 = new ApplicationNonVisualDrawingProperties();

            nonVisualConnectionShapeProperties1.Append(nonVisualDrawingProperties19);
            nonVisualConnectionShapeProperties1.Append(nonVisualConnectorShapeDrawingProperties1);
            nonVisualConnectionShapeProperties1.Append(applicationNonVisualDrawingProperties19);

            ShapeProperties shapeProperties17 = new ShapeProperties();



            D.Transform2D transform2D18 = new D.Transform2D() { HorizontalFlip = true };
            D.Offset offset19 = new D.Offset() { X = 5945032L, Y = 5032078L };
            D.Extents extents19 = new D.Extents() { Cx = 5033L, Cy = 1044000L };
            transform2D18.Append(offset19);
            transform2D18.Append(extents19);

            D.PresetGeometry presetGeometry17 = new D.PresetGeometry() { Preset = D.ShapeTypeValues.Line };
            D.AdjustValueList adjustValueList17 = new D.AdjustValueList();

            presetGeometry17.Append(adjustValueList17);
            D.NoFill noFill17 = new D.NoFill();

            D.Outline outline33 = new D.Outline() { Width = 25400, CapType = D.LineCapValues.Flat,
                                                    CompoundLineType = D.CompoundLineValues.Single,
                                                    Alignment = D.PenAlignmentValues.Center
            };

            D.SolidFill solidFill49 = new D.SolidFill();
            D.SystemColor systemColor29 = new D.SystemColor() { Val = D.SystemColorValues.WindowText, LastColor = "000000" };

            solidFill49.Append(systemColor29);
            D.PresetDash presetDash17 = new D.PresetDash() { Val = D.PresetLineDashValues.Solid };

            outline33.Append(solidFill49);
            outline33.Append(presetDash17);
            D.EffectList effectList33 = new D.EffectList();

            shapeProperties17.Append(transform2D18);
            shapeProperties17.Append(presetGeometry17);
            shapeProperties17.Append(noFill17);
            shapeProperties17.Append(outline33);
            shapeProperties17.Append(effectList33);

            connectionShape1.Append(nonVisualConnectionShapeProperties1);
            connectionShape1.Append(shapeProperties17);
            shape = connectionShape1;
Thanks in Advance

How to find and modify just this item in Office Doc chart?

$
0
0

<c:chart><c:plotArea><c:layout/><c:valAx><c:axId val="470561776"/><c:scaling><c:orientation val="minMax"/><c:max val="1"/>
Trying to drill into the xml and modify the value for Max axis


Bradley :)

Update data from embedded chart in a PowerPoint with C# OpenXML

$
0
0

Hello,

I would like to update data from a chart into a powerpoint template.

I try many things to access the embedded data but i don't know how access it. 

When, i browsed the different part of the slide i founded in OleObject. Is it in this object that the data was store or maybe in the embedObjectPart ?

For information, the template use Think-Cell plugin.

My goal is to automate the generation of a PPT based on a template.

Thanks in advance !

Can a Script be added to a bar chart to FORCE its Axis value?

$
0
0

I use openXML to update a barchart on a word doc.  When it was just the value 0 - 100% it worked fine.  now?  it MUST show the Percent % Axis on the bottom to be scaled to the largest value

But in Excel?  its like this:

The colors are off, but the blue/orange bar chart shows up right in Excel.  In word? it insists on scaling it.  If the scaling is changed from auto? then it sets that as the maximum limit.  It may be 105 or 150 or 220 for a value and it needs to show the axis accordingly.  if a value is 112?  the bottom axis value must end at 120.

But if its 100?  then it cannot extend.  for some reason Word wants to auto scale the axis to 120% if the value is 100%

On a 0-100% barchart?  if you exceed 100 then the bar shrinks and the 100% axis mark doesnt change

So is there a way to add some custom script to a word document?  To modify the barchart after its been stuffed with values?


Bradley :)

Digitally (fully) sign a Package (eg. docx or xlsx)

$
0
0

As we have seen here: https://msdn.microsoft.com/en-us/library/Aa905326.aspx 

it is reasonably easy to sign a document package. However if I do this with my example .docx document, I always receive a "partly signed" document. In comparison, if I sign the document with Word itself.... next time opened, it shows "fully/completely signed" with signature Xxxx Xxxx. This confuses users and maybe it is even just a very unimportant part, that is signed. 

What went wrong? I want a completely signed document.

Here is my working example:

            using (var wd = WordprocessingDocument.Open(ofd.FileName, true))
            {
                Package wdPackage = wd.Package;
                List<Uri> packageParts2sgn = wdPackage.GetParts().ToList()
                        .Where(part => !PackUriHelper.IsRelationshipPartUri(part.Uri))
                        .Select(p => p.Uri)
                        .ToList();
                {

                    PackageDigitalSignatureManager dsm = new PackageDigitalSignatureManager(wdPackage);
                    PackageRelationshipCollection relationships = wdPackage.GetRelationships();
                    List<PackageRelationshipSelector> relShipSelectors = relationships.Select(
                                rl =>
                                    new PackageRelationshipSelector(
                                        rl.SourceUri,
                                        PackageRelationshipSelectorType.Id,
                                        rl.Id)).ToList();

                    X509Store store = new X509Store(StoreLocation.CurrentUser);
                    store.Open(OpenFlags.ReadOnly);

                    X509Certificate2Collection collection = store.Certificates.Find(X509FindType.FindBySerialNumber,"600d923c00010014444e",true);
                    var certificate = collection[0];
                    dsm.CertificateOption = CertificateEmbeddingOption.InSignaturePart;
                    dsm.Sign(packageParts2sgn, certificate, relShipSelectors);

                }

DocumentFormat.OpenXML add watermark

$
0
0

Hello together,

my issues is to add a watermark (only text) to a Word document.

As a library for accessing the Word document DocumentFormat.OpenXML is used, and I found one solution on the internet  which is really long and hardly readable.

Is there any short solution to add a watermark via this library. In case the category is not correct a hint on which category would be more suitable would be good.

Yours sincerely,

Simon Rühle


Getting "Powerpoint found a problem with the content-..." alert on opening a Powerpoint edited using Open XML

$
0
0

I am inserting a table into Powerpoint using Open XML SDK but it is throwing an error saying "PowerPoint found a problem with content in Filename.pptx. PowerPoint can attempt to repair the presentation. If you trust the source of this presentation , click repair."


Below is my code

class Program    {        static void Main(string[] args)        {            const string path = @"C:\UsersDocuments\PPTDemo\NewSlide.pptx";            using (PresentationDocument doc = PresentationDocument.Open(path, true))            {                CreateTableInLastSlide(doc);            }        }        private static void CreateTableInLastSlide(PresentationDocument presentationDocument)        {            // Get the presentation Part of the presentation document             PresentationPart presentationPart = presentationDocument.PresentationPart;           // Get the Slide Id collection of the presentation document           var slideIdList = presentationPart.Presentation.SlideIdList;            // Get all Slide Part of the presentation document             var list = slideIdList.ChildElements                        .Cast<SlideId>()                        .Select(x => presentationPart.GetPartById(x.RelationshipId))                        .Cast<SlidePart>();            // Get the last Slide Part of the presentation document             var tableSlidePart = (SlidePart)list.Last();            //Declare and instantiate the graphic Frame of the new slide            P.GraphicFrame graphicFrame = tableSlidePart.Slide.CommonSlideData.ShapeTree.AppendChild(new P.GraphicFrame());            // Specify the required Frame properties of the graphicFrame             ApplicationNonVisualDrawingPropertiesExtension applicationNonVisualDrawingPropertiesExtension = new ApplicationNonVisualDrawingPropertiesExtension() { Uri = "{D42A27DB-BD31-4B8C-83A1-F6EECF244321}" };            P14.ModificationId modificationId1 = new P14.ModificationId() { Val = 3229994563U };            modificationId1.AddNamespaceDeclaration("p14""http://schemas.microsoft.com/office/powerpoint/2010/main");            applicationNonVisualDrawingPropertiesExtension.Append(modificationId1);            graphicFrame.NonVisualGraphicFrameProperties = new P.NonVisualGraphicFrameProperties            (new A.NonVisualDrawingProperties() { Id = 5, Name = "table 1" },            new A.NonVisualGraphicFrameDrawingProperties(new A.GraphicFrameLocks() { NoGrouping = true }),            new ApplicationNonVisualDrawingProperties(new ApplicationNonVisualDrawingPropertiesExtensionList(applicationNonVisualDrawingPropertiesExtension)));            graphicFrame.Transform = new Transform(new A.Offset() { X = 1650609L, Y = 4343400L }, new A.Extents() { Cx = 6096000L, Cy = 741680L });            // Specify the Griaphic of the graphic Frame             graphicFrame.Graphic = new A.Graphic(new A.GraphicData(GenerateTable()) { Uri = "http://schemas.openxmlformats.org/drawingml/2006/table" });            presentationPart.Presentation.Save();        }        private static A.Table GenerateTable()        {            string[,] tableSources = new string[,] { { "name""age" }, { "Tom""25" } };            // Declare and instantiate table             A.Table table = new A.Table();            // Specify the required table properties for the table            A.TableProperties tableProperties = new A.TableProperties() { FirstRow = true, BandRow = true };            A.TableStyleId tableStyleId = new A.TableStyleId();            tableStyleId.Text = "{5C22544A-7EE6-4342-B048-85BDC9FD1C3A}";            tableProperties.Append(tableStyleId);            // Declare and instantiate tablegrid and colums            A.TableGrid tableGrid1 = new A.TableGrid();            A.GridColumn gridColumn1 = new A.GridColumn() { Width = 3048000L };            A.GridColumn gridColumn2 = new A.GridColumn() { Width = 3048000L };            tableGrid1.Append(gridColumn1);            tableGrid1.Append(gridColumn2);            table.Append(tableProperties);            table.Append(tableGrid1);            for (int row = 0; row < tableSources.GetLength(0); row++)            {                // Instantiate the table row                A.TableRow tableRow = new A.TableRow() { Height = 370840L };                for (int column = 0; column < tableSources.GetLength(1); column++)                {                    tableRow.Append(CreateTextCell(tableSources.GetValue(row, column).ToString()));                }                table.Append(tableRow);            }            return table;        }

Apache POI - Open XML tool reports no validation errors but powerpoint always wants to repair file...

$
0
0

Hi,

I'm working with Apache POI libraries to generate presentation documents by merging existing presentations together. I have faced a problem whereby, Powerpoint always wants to repair the file, and when it does, the content is exactly as I expect it. Open XML SDK Tool reports no validation errors, so I'm looking for ideas why powerpoint wants to repair the files? Is there a way to see what powerpoint has actually repaired?


Thanks

Lakhvir 

Unable to rotate Line shape in particular angle in PPT

$
0
0

I have created a Line shape in PPT but i am unable to rotate it in particular angle.

Below is code block

D.Outline outline = new D.Outline(
				new D.SolidFill(new D.RgbColorModelHex() { Val = lineColor.ToRGBHex() }),
				new D.PresetDash() { Val = D.PresetLineDashValues.Solid }) // solid line
			{
				Width = (Int32)(lineWidth * ShapeUtilites.EMUPerPoint),
				CapType = D.LineCapValues.Round,
				CompoundLineType = D.CompoundLineValues.Single,
				Alignment = D.PenAlignmentValues.Center,

			};


            shape.ShapeProperties.Append(
                new D.PresetGeometry(new D.AdjustValueList()) { Preset = D.ShapeTypeValues.Line },
                new D.NoFill(),
                outline,
                new D.EffectList());

			shape.NonVisualConnectionShapeProperties = new P.NonVisualConnectionShapeProperties(
				new P.NonVisualDrawingProperties() { Id = this.shapeId, Name = this.shapeName },
				new P.NonVisualConnectorShapeDrawingProperties(),
				new P.ApplicationNonVisualDrawingProperties());

Thanks

Ankur

How to read Excel(xlsx) file header/footer by using Open Xml in C#

$
0
0
How to read Excel(xlsx) file header/footer by using open Xml in C#

Convert bulk using ofc.exe

$
0
0
Hi,

I want to convert all excel 97-2003 files in a folder and all sub folders to the new format.

I have installed MigrationPlanningManager.exe into the system and I have also installed FileFormatConverters.exe (icluding SP2)

Then I Have configured C:\OMPM\ofc.ini, I only have changed the follwing lines:
[RUN]
; LogDestinationPath: the path where the log files will be written to
LogDestinationPath=C:\OMPM\OFCLogs
[FoldersToConvert]
fldr=d:\temp
[ConversionInfo]
SourcePathTemplate=*\*\*\
DestinationPathTemplate=\*1\*2\*3\converted

Then I start C:\ompm\Tools\ofc.exe, 

.. and it works fine,  ....  except a couple of things :

1) I expected a log file  in C:\OMPM\OFCLogs, but this directory stays empty :((
    I have some files Password protected, that are not converted, and expted this ifo in the logfile.

2) Is there a way to select only excel files for conversion?
     I Do not want to convert the *.doc and *.ppt files in these directory's.

3) Is there a way to move the original files that are converted to a other directory, to be sure you do not have 2 versions and you can continue working on converted files only (I want to merge the original directory and de converted directory).

thi, Johan 

Viewing all 1288 articles
Browse latest View live