Independentsoft
- any library, any programming language
Home
Purchase
Support
Company
Contact
Spreadsheet .NET
>
Tutorial
> Superscript Text
The following example shows you how to set superscript text.
C# example
using System; using Independentsoft.Office; using Independentsoft.Office.Spreadsheet; namespace Sample { class Program { static void Main(string[] args) { Run run1 = new Run(); run1.Text = new Text("normal "); Run run2 = new Run(); run2.Text = new Text("superscript"); run2.RunVerticalAlignment = RunVerticalAlignment.Superscript; RichTextInline richTextInline = new RichTextInline(); richTextInline.Runs.Add(run1); richTextInline.Runs.Add(run2); Cell cell1 = new Cell(); cell1.RichTextInline = richTextInline; Worksheet sheet1 = new Worksheet(); sheet1["A1"] = cell1; Workbook book = new Workbook(); book.Sheets.Add(sheet1); book.Save("c:\\test\\output.xlsx", true); } } }
VB example
Imports System Imports Independentsoft.Office Imports Independentsoft.Office.Spreadsheet Module Module1 Sub Main(ByVal args As String()) Dim run1 As New Run() run1.Text = New Text("normal ") Dim run2 As New Run() run2.Text = New Text("superscript") run2.RunVerticalAlignment = RunVerticalAlignment.Superscript Dim richTextInline As New RichTextInline() richTextInline.Runs.Add(run1) richTextInline.Runs.Add(run2) Dim cell1 As New Cell() cell1.RichTextInline = richTextInline Dim sheet1 As New Worksheet() sheet1("A1") = cell1 Dim book As New Workbook() book.Sheets.Add(sheet1) book.Save("c:\test\output.xlsx", True) End Sub End Module
Need help? Ask our developers:
Name*
Email*
Message*