Skip to main content

Posts

Showing posts with the label Tool

A Simple Sample to Make Color List in InDesign

Here is a simple sample to make color list in InDesign. It is very simple, because, there are no left-right page handling, no color values for cyan, magenta, yellow and black, no page numbers, no comments, and no drawing the border of the color-box. And I don't have much time to reply any question. Please try it on your own. Here is the code: main(); function main() { if (app.documents.length == 0) { var myDocument = app.documents.add(); basicSetup(myDocument); myDocument.textFrames.item(0).remove(); makeSwatch(myDocument); } return 0; } function basicSetup(myDocument) { myDocSetup(myDocument); myMasterSpreads(myDocument); } function myDocSetup(myDocument) { with (myDocument.documentPreferences) { pageHeight = "29.8cm"; pageWidth = "21.6cm"; pageOrientation = PageOrientation.portrait; facingPages == true; documentBleedUniformSize = true; documentBleedTopOffset = "3p"; documentSlugUniformSize = true; slugTopOffset = ...

Tool to Convert Source Code to HTML Encoded Text in C#

It will be convenient to have a tool converting the source code to HTML encoded text, before I can post it on my blog article. The following C# code is my tool to do the job: public FormMain() { InitializeComponent(); } private void buttonExit_Click(object sender, EventArgs e) { Close(); } private void buttonRun_Click(object sender, EventArgs e) { string src = textBoxSrc.Text; string html = System.Net.WebUtility.HtmlEncode(src); textBoxHTML.Text = html; textBoxHTML.SelectAll(); textBoxHTML.Copy(); } private void textBoxSrc_MouseClick(object sender, MouseEventArgs e) { textBoxSrc.Text = ""; } The UI: Usage: Click on the textBoxSrc, the text in textBoxSrc will be cleaned. (line 26) Copy the source code to the textBoxSrc. Click the buttonRun. The converted text will be displayed on the textBoxHTML, in the same time, the text will also be copied to the clipboard for further use. (line 13 ~ 21) You may use Visual Studio Community to create the p...