News Category

Spire.Doc for .NET

Convert Word to PCL

2019-03-05 09:02:05 Written by support iceblue

PCL File is Digital printed document created in the Printer Command Language (more commonly referred to as PCL) page description language. From v7.1.19, Spire.Doc supports to convert word document to PCL. There are many kinds of standard for PCL document; the PCL here refers to PCL 6 (PCL 6 Enhanced or PCL XL). This article will show you how to save word document to PCL in C# and VB.NET by only three lines of codes.

[C#]
using Spire.Doc;

namespace DOCPCL
{
    class Program
    {
        static void Main(string[] args)
        {
            //load the sample document
            Document doc = new Document();
            doc.LoadFromFile("Sample.docx", FileFormat.Docx2010);

            //save the document as a PCL file
            doc.SaveToFile("Result.pcl", FileFormat.PCL);



        }
    }
}
[VB.NET]
Imports Spire.Doc

Namespace DOCPCL
	Class Program
		Private Shared Sub Main(args As String())
			'load the sample document
			Dim doc As New Document()
			doc.LoadFromFile("Sample.docx", FileFormat.Docx2010)

			'save the document as a PCL file
			doc.SaveToFile("Result.pcl", FileFormat.PCL)



		End Sub
	End Class
End Namespace

How to convert Word to PostScript in C#

2018-11-08 07:59:52 Written by jie zou

PostScript is a page description language that is an industry standard for outputting high-resolution text and graphics. From Version 6.11.2, Spire.Doc supports to convert doc/docx to a postscript file in both WinForm app and ASP.NET app. This article will demonstrate how to convert word to PostScript in C# and VB.NET.

Firstly, view the sample word document:

How to convert Word to PostScript in C#

[C#]
using Spire.Doc;

namespace Word
{
    class Program
    {
        static void Main(string[] args)
        {            
            Document doc = new Document();
            doc.LoadFromFile("Sample.docx", FileFormat.Docx2010);
            doc.SaveToFile("Result.ps", FileFormat.PostScript);                 
        }
    }
}
[VB.NET]
Imports Spire.Doc
Namespace Word
    Class Program
        Private Shared Sub Main(ByVal args As String())
            Dim doc As Document = New Document()
            doc.LoadFromFile("Sample.docx", FileFormat.Docx2010)
            doc.SaveToFile("Result.ps", FileFormat.PostScript)
        End Sub
    End Class
End Namespace

Effective screenshot of the resulted PostScript file converted from .docx document:

How to convert Word to PostScript in C#

Alternative text (alt text) can help people with screen readers understand the content of our table. This article is going to demonstrate how to add or get the alternative text of a table in a word document using Spire.Doc.

In Spire.Doc, we can set or get the alternative text of a table using the Table.Title and Table.TableDescription properties. The following example shows how to add alternative text to a table.

Detail steps:

Step 1: Instantiate a Document object and load a word document.

Document doc = new Document();
doc.LoadFromFile("Input.docx");

Step 2: Get the first section.

Section section = doc.Sections[0];

Step 3: Get the first table in the section.

Table table = section.Tables[0] as Table;

Step 4: Add alt text to the table.

//Add title
table.Title = "Table 1";
//Add description
table.TableDescription = "Description Text";

Step 5: Save the document.

doc.SaveToFile("output.docx", FileFormat.Docx2013);

Screenshot:

Add/Get Alternative Text of Table in Word in C#

Full code:

using Spire.Doc;

namespace Add_Alt_Text_To_Word_Table
{
    class Program
    {
        static void Main(string[] args)
        {
            //Instantiate a Document object
            Document doc = new Document();
            //Load a word document
            doc.LoadFromFile("Input.docx");

            //Get the first section
            Section section = doc.Sections[0];

            //Get the first table in the section
            Table table = section.Tables[0] as Table;
 
            //Add alt text

            //Add tile
            table.Title = "Table 1";
            //Add description
            table.TableDescription = "Description Text";

            //Save the document
            doc.SaveToFile("output.docx", FileFormat.Docx2013);            
        }
    }
}
Page 5 of 56