A file with the .ODT file extension is an OpenDocument Text document file. These files are most often created by the free OpenOffice Writer word processor program. ODT files are similar to the popular DOCX file format used with Microsoft Word. Both of the two file types can hold things like text, images, objects, and styles.

However, when you open an ODT document in Microsoft Word, the formatting of the ODT document may differ as a result of the two programs not sharing the same features. When converting ODT to DOCX or vice versa, the data and content will be converted successfully, but may not including the original formatting.

Following code snippets introduce how to convert ODT to DOC or DOCX and vice versa using Spire.Doc.

ODT to DOCX

To convert ODT to DOC, change the file extension and file format to .Doc in SaveToFile method.

[C#]
using Spire.Doc;

namespace ODTtoDOCX
{
    class Program
    {
        static void Main(string[] args)
        {
            Document doc = new Document();
            doc.LoadFromFile("SampleODTFile.odt");
            doc.SaveToFile("output.docx", FileFormat.Docx)

        }

 
    }
}
[VB.NET]
Imports Spire.Doc

Namespace ODTtoDOCX
	Class Program
		Private Shared Sub Main(args As String())
			Dim doc As New Document()
			doc.LoadFromFile("SampleODTFile.odt")
			doc.SaveToFile("output.docx", FileFormat.Docx)

		End Sub
	End Class
End Namespace

DOCX to ODT

To convert Doc to ODT, load a .Doc file format document when loading the source file.

[C#]
using Spire.Doc;
namespace DOCXtoODT
{
    class Program
    {
        static void Main(string[] args)
        {
            Document doc = new Document();
            doc.LoadFromFile("SampleODTFile.odt");
            doc.SaveToFile("output.docx", FileFormat.Docx);

        } 
    }
}
[VB.NET]
Imports Spire.Doc
Namespace DOCXtoODT
	Class Program
		Private Shared Sub Main(args As String())
			Dim doc As New Document()
			doc.LoadFromFile("SampleODTFile.odt")
			doc.SaveToFile("output.docx", FileFormat.Docx)

		End Sub
	End Class
End Namespace

Create Scatter Chart in PowerPoint in C#

2018-01-25 06:25:59 Written by Koohji

A Scatter (X Y) Chart has two value axes – X value axis and Y value axis. It combines X and Y values into single data points and shows them in irregular intervals, or clusters. This article will show you how to create scatter chart in PowerPoint using Spire.Presentation with C#.

Step 1: Create a Presentation object.

Presentation presentation = new Presentation();

Step 2: Add a "Scatter with Smooth Lines and Markers" chart to the first slide, and set the chart title.

IChart chart = presentation.Slides[0].Shapes.AppendChart(ChartType.ScatterSmoothLinesAndMarkers, new RectangleF(40, 80, 550, 320), false);
chart.ChartTitle.TextProperties.Text = "Scatter Chart";
chart.ChartTitle.TextProperties.IsCentered = true;
chart.ChartTitle.Height = 20;
chart.HasTitle = true;

Step 3: Write data to the chart data.

Double[] xdata = new Double[] { 1.0, 2.4, 5.0, 8.9 };
Double[] ydata = new Double[] { 5.3, 15.2, 6.7, 8 };
chart.ChartData[0, 0].Text = "X-Values";
chart.ChartData[0, 1].Text = "Y-Values";
for (Int32 i = 0; i < xdata.Length; ++i)
{
    chart.ChartData[i + 1, 0].Value = xdata[i];
    chart.ChartData[i + 1, 1].Value = ydata[i];
}

Step 4: Set up the data source of the X values, the Y values, and the series label.

chart.Series.SeriesLabel = chart.ChartData["B1", "B1"];
chart.Series[0].XValues= chart.ChartData["A2", "A5"];
chart.Series[0].YValues = chart.ChartData["B2", "B5"];

Step 5: Add and display the data labels in the chart.

for (int i = 0; i < 4; i++)
{
    ChartDataLabel dataLabel = chart.Series[0].DataLabels.Add();
    dataLabel.LabelValueVisible = true;
}

Step 6: Set the axis titles.

chart.PrimaryValueAxis.HasTitle = true;
chart.PrimaryValueAxis.Title.TextProperties.Text = "X-Axis Title";
chart.SecondaryValueAxis.HasTitle = true;
chart.SecondaryValueAxis.Title.TextProperties.Text = "Y-Axis Title";

Step 7: Format the gridlines.

chart.SecondaryValueAxis.MajorGridTextLines.FillType = FillFormatType.Solid;
chart.SecondaryValueAxis.MajorGridTextLines.Style = TextLineStyle.ThinThin;
chart.SecondaryValueAxis.MajorGridTextLines.SolidFillColor.Color = Color.Gray;
chart.PrimaryValueAxis.MajorGridTextLines.FillType = FillFormatType.None;

Step 8: Format the outline.

chart.Series[0].Line.FillType = FillFormatType.Solid;
chart.Series[0].Line.Width = 0.1f;
chart.Series[0].Line.SolidFillColor.Color = Color.RoyalBlue;

Step 9: Save the file.

presentation.SaveToFile("ScatterChart.pptx", FileFormat.Pptx2010);

Output:

Create Scatter Chart in PowerPoint in C#

Full Code:

using Spire.Presentation;
using Spire.Presentation.Charts;
using Spire.Presentation.Drawing;
using System;
using System.Drawing;

namespace CreateScatterChart
{
    class Program
    {
        static void Main(string[] args)
        {
            Presentation presentation = new Presentation();
            IChart chart = presentation.Slides[0].Shapes.AppendChart(ChartType.ScatterSmoothLinesAndMarkers, new RectangleF(40, 80, 550, 320), false);
            chart.ChartTitle.TextProperties.Text = "Scatter Chart";
            chart.ChartTitle.TextProperties.IsCentered = true;
            chart.ChartTitle.Height = 20;
            chart.HasTitle = true;

            Double[] xdata = new Double[] { 1.0, 2.4, 5.0, 8.9 };
            Double[] ydata = new Double[] { 5.3, 15.2, 6.7, 8 };
            chart.ChartData[0, 0].Text = "X-Values";
            chart.ChartData[0, 1].Text = "Y-Values";
            for (Int32 i = 0; i < xdata.Length; ++i)
            {
                chart.ChartData[i + 1, 0].Value = xdata[i];
                chart.ChartData[i + 1, 1].Value = ydata[i];
            }

            chart.Series.SeriesLabel = chart.ChartData["B1", "B1"];
            chart.Series[0].XValues = chart.ChartData["A2", "A5"];
            chart.Series[0].YValues = chart.ChartData["B2", "B5"];

            for (int i = 0; i < 4; i++)
            {
                ChartDataLabel dataLabel = chart.Series[0].DataLabels.Add();
                dataLabel.LabelValueVisible = true;
            }

            chart.PrimaryValueAxis.HasTitle = true;
            chart.PrimaryValueAxis.Title.TextProperties.Text = "X-Axis Title";
            chart.SecondaryValueAxis.HasTitle = true;
            chart.SecondaryValueAxis.Title.TextProperties.Text = "Y-Axis Title";

            chart.SecondaryValueAxis.MajorGridTextLines.FillType = FillFormatType.Solid;
            chart.SecondaryValueAxis.MajorGridTextLines.Style = TextLineStyle.ThinThin;
            chart.SecondaryValueAxis.MajorGridTextLines.SolidFillColor.Color = Color.Gray;
            chart.PrimaryValueAxis.MajorGridTextLines.FillType = FillFormatType.None;

            chart.Series[0].Line.FillType = FillFormatType.Solid;
            chart.Series[0].Line.Width = 0.1f;
            chart.Series[0].Line.SolidFillColor.Color = Color.RoyalBlue;

            presentation.SaveToFile("ScatterChart.pptx", FileFormat.Pptx2010);
        }
    }
}

We have already demonstrated how to set the animations on shapes in PowerPoint. Now Spire.Presentation starts to support set the Animation Effect for the type and time of the animate text. This article will show you how to use IterateType property and IterateTimeValue property for animation Effect to set the type and time of animate text in C#.

Firstly, view the original sample document with animate text effect with "All at once".

C# Set animation effect for the animate text on the presentation slides

Step 1: Create a presentation instance and load the sample document from file.

Presentation ppt = new Presentation();
ppt.LoadFromFile("Sample.pptx",FileFormat.Pptx2010);

Step 2: Set the AnimateType as Letter.

ppt.Slides[0].Timeline.MainSequence[0].IterateType = Spire.Presentation.Drawing.TimeLine.AnimateType.Letter;

Step 3: Set the IterateTimeValue for the animate text.

ppt.Slides[0].Timeline.MainSequence[0].IterateTimeValue = 10;

Step 4: Save the document to file.

ppt.SaveToFile("Result.pptx", FileFormat.Pptx2010);

Effective screenshot of the animation effect for the animate text effect with "by Letter".

C# Set animation effect for the animate text on the presentation slides

C# Set animation effect for the animate text on the presentation slides

page 181