Insert vertical text

Technical support for Spire.Doc

Moderator: iceblue support

Insert vertical text

Postby catalin » Mon Sep 24, 2012 11:34 am

Hello,

I can't figure out how to insert some vertical text, to be on a side of a document. Could you please provide me a short example?
Thank you very much.
catalin
 
Posts: 48
Joined: Wed Mar 14, 2012 12:56 pm

Re: Insert vertical text

Postby amy.zhao » Tue Sep 25, 2012 8:45 am

Dear catalin,

Thanks for your inquiry.
If inserting some vertical text into a document directly that can result in whole document into vertical, so we decide to put text into a table, and set the featrue "TextDirection.RightToLeftRotated". If you still have the problem, please tell us.
Code: Select all
            Document document = new Document();
            Table table = document.AddSection ().AddTable();
            table.ResetCells(1,1);
            TableCell cell = table.Rows[0].Cells[0];
            table.Rows[0].Height =150;
            cell.AddParagraph().AppendText("Hello,world: vertical style");           
            cell.CellFormat.TextDirection = TextDirection.RightToLeftRotated;
            document.SaveToFile("sample.docx",FileFormat.Docx );


Best regards,
Amy
e-iceblue support
User avatar
amy.zhao
 
Posts: 2241
Joined: Wed Jun 27, 2012 8:50 am

Re: Insert vertical text

Postby catalin » Wed Sep 26, 2012 12:52 pm

Yes, it works, but i would like to insert some text as a sort of a sidebar, something like a copyright text, which will on the right side, in a vertical position, outside my main document content.

Can i do that with Spire.Doc?

Thank you
catalin
 
Posts: 48
Joined: Wed Mar 14, 2012 12:56 pm

Re: Insert vertical text

Postby amy.zhao » Thu Sep 27, 2012 11:00 am

Dear catalin,

About your requirement, we provide you a demo. If you have any problem, please feel free to contact us.
Code: Select all
            Document document = new Document("Word.doc");
            Table table = document.Sections[0].AddTable();
            table.ResetCells(1, 1);
            TableCell cell = table.Rows[0].Cells[0];
            table.Rows[0].Height = 150;
            table.Rows[0].Cells[0].Width = 10;
            cell.CellFormat.TextDirection = TextDirection.RightToLeftRotated;
            cell.AddParagraph().AppendText("Hello,world: vertical style");

            table.TableFormat.WrapTextAround = true;
            table.TableFormat.Positioning.VertRelationTo = VerticalRelation.Page;
            table.TableFormat.Positioning.HorizRelationTo = HorizontalRelation.Page;
            table.TableFormat.Positioning.HorizPosition = document.Sections[0].PageSetup.PageSize.Width - table.Width;
            table.TableFormat.Positioning.VertPosition = 200;

            document.SaveToFile("sample.docx", FileFormat.Docx);

Best regards,
Amy
e-iceblue support
User avatar
amy.zhao
 
Posts: 2241
Joined: Wed Jun 27, 2012 8:50 am


Return to Spire.Doc

Who is online

Users browsing this forum: No registered users and 0 guests