C# convert HTML bold Style in InDesign Styles

Hello

I am trying to create a function that translated HTML "< b >" and "< strong >" tags bold InDesign styles.

For example, the HTML code:

<b>Bold Text</b> and another <strong>Bold Text</strong>




Would lead to this view in your browser:

Bold text and other text in bold


If I try to put a paragraph of the foregoing in InDesign, it would make just as-is without any greasy effect.

For example:

            Application application = ActivateInDesign();//A custom function that activates InDesign
            // Create new document
            application.Documents.Add(true, application.DocumentPresets.FirstItem());
            // Get active document and change some settings
            Document document = application.ActiveDocument;
            // Get first page (already created) and set margins
            Page page = (Page)document.Pages[1];
            // Add text frame object that holds texts.
            TextFrame textFrame = page.TextFrames.Add(document.Layers.FirstItem(), idLocationOptions.idUnknown, page);
            // Set the position and size (geometrics) of the text frame to be the whole size of the page up to the page.
            textFrame.GeometricBounds = page.Bounds;
            textFrame.Contents = "<b>Bold Text</b> and another <strong>Bold Text</strong>";



Give me this output:

Capture.JPG

When I really want is something like this:

Capture.2JPG.JPG

So, I'm working on this function to convert the HTML to InDesign.

However, in the event after stripping the tags '< b >' and "< strong >" and get the index/position of bold text.

I can't understand how can I style a sub to a paragraph in c# string.

If anyone knows how I can style a part of the paragraph?

Try this,

An application = ActivateInDesign (); A custom function which activates InDesign

Create new document

request. Documents.Add (true, application.) DocumentPresets.FirstItem ());

Download the active document and change some settings

Document document = application. ActiveDocument;

Get first page (already created) and set the margins

A page = document (pages). Pages: [1];

Add the text frame object that contains text.

TextFrame textFrame = page. TextFrames.Add (document). Layers.FirstItem (), idLocationOptions.idUnknown, page);

Define the position and size of the block of text to the full size of the page until the page (geometry).

textFrame.GeometricBounds = page. Limits;

textFrame.Contents ="text"BOLD" and an another "BOLD"text";

request. FindGrepPreferences = application. ChangeGrepPreferences = idNothingEnum.idNothing;

request. FindGrepPreferences.FindWhat = "(<.+?>)(.+?)". ()";

request. ChangeGrepPreferences.ChangeTo = "$2";

request. ChangeGrepPreferences.FontStyle = 'bold ';

document. ChangeGrep();

Kind regards

Cognet

Tags: InDesign

Similar Questions

  • Convert HTML to PDF

    Can you ColdFusion take a snapshot of an HTML page and convert it into a PDF file? I want to automate a process where a user accesses a page HTML, updates the data in a word document, and then convert the word document to PDF format and stores. ColdFusion allows to eliminate the user? Can I just put in place a process to the administrator to run a script once a month that can do this?

    * convert HTMl page to PDF

    * And then place the file in the folder to archive

    I'm trying to convince the owners to simply make a form that fits into a DB, but old habits are hard to break. Until then, the foregoing is possible?

    * convert HTMl page to PDF

    Yes, using CFDOCUMENT. If this entry is on the pictures, it shows how you can use cfdocument to capture the HTML from a url and convert it to pdf format

    http://www.coldfusionjedi.com/index.cfm/2007/6/13/ColdFusion-8-URL-thumbnails

    Just be aware THAT CFDOCUMENT is not perfect. It does not always handle complex CSS styles. But for basic html, it should do the job.

    * And then place the file in the folder to archive

    Use the "filename" attribute to save the file anywhere you want. See the documentation for more details.

  • Get the converted HTML (dynamic converter) content of external application

    According to the requirement, external application (java application) assume to get dynamic content (HTML version) converted from the Complutense University of MADRID.
    I am trying to run the GET_DYNAMIC_CONVERSION service with call of web service client and CRMI.
    I see no content HTML is coming as the result of the GET_DYNAMIC_CONVERSION service.
    Could you please guide me in getting converted HTML document to external application.
    Let me know if you need further details.

    Thanks in advance

    Published by: 958795 on Sep 12, 2012 15:29

    Thank you, Ryan. Keep right em... :-)

    IIRC, by default, when the call to this service via RIDC, will get you service data returned back to you in a format of .hda.

    Add "IsJava = 0" to your request for the HTML code instead, for example

    binder.putLocal("IsJava","0")

  • Convert the local Word to indesign character style formatting

    Hello

    I have a Word doc with local formatting (no paragraph or character style)

    Is there a way I can convert all text which is Times New Roman Italic in a style of character so that I can format everything at the global level?

    Any help in this would be be surprising (250 pages)

    Find > Find format > basic character formats > Font Style > Italic

  • Complex GREP "BOLD" style a colon and escape a colon

    Here is my challenge in a unique style of GREP.   I am trying to write a grep style will make an exception for the colon to 07:30 but will be "BOLD" all characters and including the colon in the example "today."

    Here is what I tried > > ^ [^?:] +: does a good job, forgetting any subsequent colon and trap the first condition in "BOLD".  However, it will be "BOLD" all the characters, including the two points in the first example.

    So I then tried to combine the first part of the GREP with this > > (\d:\d) but that did nothing.

    The quick brown fox jumped over the lazy dog at 7:30 pm. He was late for an appointment.


    Today: Watch the quick brown fox jumped over the lazy dog at 19:30. He was late for an appointment.



    Should I focus on a game?

    Thank you, everyone.

    If I understand the exact purpose, you want to find a colon, but not when the colon is followed by a digit.

    Then try this one: ^ [^?:] +: (? \d)

  • The skin of the sparks - convert Flex 3 style

    I'm not asking to do a job for me but what would it take to convert the next spark in Flex 3 skin styles. Assuming that it is even remotely possible:

    <? XML version = "1.0" encoding = "utf-8"? >

    " < = xmlns:fx s:SparkSkin ' http://ns.Adobe.com/MXML/2009 "

    xmlns:s = "library://ns.adobe.com/flex/spark".

    minWidth = "85" minHeight = "27" alpha.disabled = "0.5"

    >

    < fx:Metadata >

    [HostComponent ("spark.components.Button")]

    < / fx:Metadata >

    < fx:Script >

    <! [CDATA]

    Import mx.events.StateChangeEvent;

    / * Set the skin elements that should not be colorized.

    For the button, the graphics are colorized but the label is not. */

    public static private const exclusions: Array = ["labelDisplay"];

    [Bindable] private var _fillHighAlphaOver:Number;

    [Bindable] private var _fillHighAlphaDown:Number;

    [Bindable] private var _fillLow:uint = 0 x 000000;

    [Bindable] private var _fillHigh:uint = 0xFFFFFF;

    [Bindable] private var _highlight1:uint = 0xFFFFFF;

    [Bindable] private var _highlight2:uint = 0xD8D8D8;

    [Bindable] private var _highlightDown1:uint = 0 x 000000;

    [Bindable] private var _highlightDown2:uint = 0 x 000000;

    [Bindable] private var _rollOverTextColor:uint = 0 x 333333;

    [Bindable] private var _selectedTextColor:uint = 0 x 333333;

    private var _borderColor:uint = 0 x 373830;

    private var hlight:Boolean;

    override public function get colorizeExclusions (): Array {return exclusions ;}

    override protected function initializationComplete (): void

    {

    useChromeColor = true;

    super.initializationComplete ();

    var rotc:uint = hostComponent.getStyle ("rolloverTextColor");

    {if (ROTC)}

    _rollOverTextColor = rotc;

    }

    var stc:uint = hostComponent.getStyle ("selectedTextColor");

    {if (STC)}

    _selectedTextColor = stc;

    }

    var fc:Array = hostComponent.getStyle ("fillColors");

    {if (CF)}

    fill1. Color = fc [0];

    fill2. Color = fc [1];

    }

    var bc:uint = hostComponent.getStyle ("borderColor");

    {if (BC)}

    _borderColor = bc;

    }

    var color: uint = hostComponent.getStyle("color");

    {if (Color)}

    labelDisplay.setStyle ("color", color);

    }

    var fl:uint = hostComponent.getStyle ("fillLow");

    var fh:uint = hostComponent.getStyle ("fillHigh");

    var fhs:Array = hostComponent.getStyle ("fillHighStrokes");

    var fhds:uint = hostComponent.getStyle ("fillHighDownStrokes");

    If (FL)

    _fillLow = fl;

    If (FH)

    _fillHigh = fh;

    {if (FHS)}

    fhs = _highlight1 [0];

    _highlight2 = fhs [1];

    }

    {if (FHDS)}

    _highlightDown1 = fhds;

    _highlightDown2 = fhds;

    }

    Border.visible = hostComponent.getStyle ("borderVisible");

    crttr = hostComponent.getStyle ("skinHighlight");

    }

    override protected function updateDisplayList (unscaledWidth:Number, unscaledHeight:Number): void

    {

    var cr:Number = value ("cornerRadius");

    If (cornerRadius! = cr)

    {

    cornerRadius = cr;

    shadow.radiusX = cornerRadius;

    fill.radiusX = cornerRadius;

    lowlight.radiusX = cornerRadius;

    highlight.radiusX = cornerRadius;

    border.radiusX = cornerRadius;

    }

    If (highlightStroke) highlightStroke.radiusX = cornerRadius;

    If (hldownstroke1) hldownstroke1.radiusX = cornerRadius;

    If (hldownstroke2) hldownstroke2.radiusX = cornerRadius;

    borderStroke.color = _borderColor;

    lowlight.visible = crttr;

    Highlight.visible = crttr;

    If (highlightStroke) highlightStroke.visible = crttr;

    If (hldownstroke1) hldownstroke1.visible = crttr;

    If (hldownstroke2) hldownstroke2.visible = crttr;

    super.updateDisplayList (unscaledWidth, unscaledHeight);

    }

    private var cornerRadius:Number = 2;

    []] >

    < / fx:Script >

    <! - States - >

    < s: states >

    < name s: State = "mounted" / >

    < name s: State = "over" / >

    < name s: State = "low" / >

    < name s: State = "disabled" / >

    < / s: states >

    <!--> drop shadow

    < s:Rect id = "shadow" left = "-1" right = "-1" high = low '-1' = '-1' radiusX = "2" >

    < s:fill >

    < s:LinearGradient rotation = "90" >

    "< s:GradientEntry color ="0x000000"color.down ="0xFFFFFF"alpha ="0.01"alpha.down =" 0 "/ >

    "< s:GradientEntry color ="0x000000"color.down ="0xFFFFFF"alpha ="0.07"alpha.down =" 0.5 "/ >

    < / s:LinearGradient >

    < / s:fill >

    < / s:Rect >

    <!-layer 2: fill->

    <!---@private-->

    < s:Rect id = "fill" left = "1" right = "1" top down = '1' = '1' radiusX = "2" >

    < s:fill >

    < s:LinearGradient rotation = "90" >

    < s:GradientEntry id = "fill1" color = "0x7B82C3" alpha = "0.85" alpha.down="0.6375"/ >

    < s:GradientEntry id = "fill2" color = "0x4378AA" alpha = "0.85" alpha.down="0.6375"/ >

    < / s:LinearGradient >

    < / s:fill >

    < / s:Rect >

    <!-layer 3: filling lowlight->

    <!---@private-->

    < s:Rect id = "lowlight" left = "1" right = "1" top down = '1' = '1' radiusX = "2" >

    < s:fill >

    < s:LinearGradient rotation '270' = >

    < s:GradientEntry id = "fillLow1" color = ratio "{_fillLow}" = "0,0" alpha = "0,0627" / >

    < s:GradientEntry id = "fillLow2" color = ratio "{_fillLow}" = "0.48" alpha = "0,0099" / >

    < s:GradientEntry id = "fillLow3" color = ratio "{_fillLow}" = "0.48001" alpha = "0" / >

    < / s:LinearGradient >

    < / s:fill >

    < / s:Rect >

    <!-layer 4: highlight of fill->

    <!---@private-->

    < s:Rect id = "highlight" left = "1" right = "1" top down = '1' = '1' radiusX = "2" >

    < s:fill >

    < s:LinearGradient rotation = "90" >

    < s:GradientEntry id = "fillHigh1" color = ratio "{_fillHigh}" = "0,0" alpha = "0.33" alpha.over = "0.22" alpha.down="0.12"/ > "

    "< s:GradientEntry id ="fillHigh2"color ratio"{_fillHigh}"= '0.48' = alpha = alpha.over =" 0.22 "0.33" "alpha.down =" 0.12 "/ >

    < s:GradientEntry id = "fillHigh3" color = ratio "{_fillHigh}" = "0.48001" alpha = "0" / >

    < / s:LinearGradient >

    < / s:fill >

    < / s:Rect >

    <!-layer 5: race to highlight (all States except down)->

    <!---@private-->

    < s:Rect id = "highlightStroke" left = right '1' = '1' top low = '1' = '1' = '2' = 'low' excludeFrom radiusX >

    < s:stroke >

    < s:LinearGradientStroke rotation = "90" weight = "1" >

    < s:GradientEntry id = 'highlight1' color = "{_highlight1}" alpha.over = "0.22" / > "

    < s:GradientEntry id = "highlight2" color = "{_highlight2}" alpha.over = "0.22" / > "

    < / s:LinearGradientStroke >

    < / s:stroke >

    < / s:Rect >

    <!-layer 6: highlight of the stroke (to the low State only)->

    <!---@private-->

    < s:Rect id = "hldownstroke1" left = "1" right = "1" top down = '1' = '1' radiusX = "2" includeIn = "bottom" >

    < s:stroke >

    < s:LinearGradientStroke rotation = "90" weight = "1" >

    < s:GradientEntry color = alpha "{_highlightDown1}" = "0.25" ratio = "0,0" / >

    < s:GradientEntry color = alpha "{_highlightDown1}" = "0.25" ratio = "0.001" / >

    < s:GradientEntry color = alpha "{_highlightDown1}" = "0.07" ratio = "0,0011" / >

    < s:GradientEntry color = alpha "{_highlightDown1}" = "0.07" ratio = "0.965" / >

    < s:GradientEntry color = alpha "{_highlightDown1}" = '0.00' ratio = "0.9651" / >

    < / s:LinearGradientStroke >

    < / s:stroke >

    < / s:Rect >

    < s:Rect id = "hldownstroke2" left = "2" right = "2" high low = '2' = '2' radiusX = "2" includeIn = "bottom" >

    < s:stroke >

    < s:LinearGradientStroke rotation = "90" weight = "1" >

    < s:GradientEntry color = alpha "{_highlightDown2}" = '0.09' ratio '0.0' = / >

    < s:GradientEntry = "{_highlightDown2}" alpha = "0.00" color ratio = "0.0001" / >

    < / s:LinearGradientStroke >

    < / s:stroke >

    < / s:Rect >

    <!-Layer 7: border - put it on top of the filling so it does not disappear when the scale is less than 1->

    <!---@private-->

    < s:Rect id = 'border' left right '0' is is '0' high = low "0" = "0" width = "100%" height = "100%" radiusX = "2" >

    < s:stroke >

    "< s:SolidColorStroke id ="borderStroke"color.over ="0x00FF00"weight ="1"alpha ="1"alpha.down =" 0.6375 "/ >

    <!-< s:LinearGradientStroke rotation = weight "90" = "1" >

    < s:GradientEntry id = "border1" alpha = "0.5625" alpha.down = "0.6375" / > "

    < s:GradientEntry id = "border2" alpha = "0.75" alpha.down = "0.85" / > "

    < / s:LinearGradientStroke >->

    < / s:stroke >

    < / s:Rect >

    <!-layer 8: text-->

    <! spark.components.supportClasses.ButtonBase #labelDisplay->---@copy

    < s:Label id = "labelDisplay".

    textAlign = "center".

    verticalAlign = "middle".

    maxDisplayedLines = "1".

    Color.over = "{_rollOverTextColor}" "

    Color.Down = "{_selectedTextColor}" "

    horizontalCenter = "0" = "1" Red

    left = "10" right = "10" top = low "2" = "2" >

    < / s:Label >

    < / s:SparkSkin >

    Appreciate any help.

    The sparkskins project.  In a folder of the Flex 4 sdk, there should be a record of frameworks/projects with several projects in it.

  • HTML text style tags

    I have a database that is used to contain the content on a Web site.
    I want to use this same database for my Flex application.

    The problem is, that the content of the database (saved as html) is rendered in a strange way.
    There is a lag between the < p > from around 70px.
    Is there a way to style within a label.htmlText content?

    Thanks in advance.

    "cryothic" wrote in message
    News:gcj57h$39l$1@forums. Macromedia.com...
    > I have a database that is used to contain the content on a Web site.
    > I want to use this same database for my Flex application.
    >
    > The problem is, that the content of the database (saved as html) is rendered
    > in
    > a strange way.
    > There is a gap between the

    s all about 70px.
    > Is it possible to style within a label.htmlText content?

    condenseWhiteSpace?

  • How to convert a 2D Image into 3D to create a video with still photograph old 3D Photo converted video 2d style 3D (Photoshop and After Effects)

    Hello

    How to convert a 2D to 3D Image

    Create a video with always shoot in 3d

    Old Photo converted to 3D as video 2d

    (Photoshop and After Effects)

    Thank you

    It's called a cinemagraphs.com. You slice the image in the foreground and background elements, plug the holes and then place them in a 3D space - in after effects or a 3D program, no PS

    Mylenium

  • definition of apex html button style

    Hello

    I'm trying to define a toggle button with Javascript. I use the default html button and I have this blue border when I click it (already done by Apex) and back to its original gray color, when I click a second time on this subject. How can I do with Javascript?

    I'm sorry I'm not good at drawing.

    Thanks for your help.

    Max

    Max,
    You can define a class in the header and toggle the class for the button when you click it.

    Here's how you can do

    Add this to the Page header - the class name is lined and it adds a blue border of 1 px to element

    Now add the following line to load javascript page

    $('#BUTTON_ID').click (function() {}
    $(this) .toggleClass ('will');
    });

    It works on a button ID: BUTTON_ID, u may need to manually add an id in the section attributes of button as

    ID = "BUTTON_ID".

    Please change the BUTTON_ID the ID u set for your button.

  • The new dose of option "tilt" is not displayed. I only get the 'HTML' and 'STYLE' buttons in the bar of dev background. Why?

    Can't seem to get the new button "tilt".

    3D view (tilt) use WebGL to achieve, so you can check at the bottom of the help > page troubleshooting information in the graphic section to see if there are problems with WebGL reported.

  • Could not find 'index.html '. "styles.css" is not found.

    Hi all. I've tried recently doing some tutorials, I can learn more about css and I came up with a problem... I only work locally on a local folder and Dreamweaver seems to not be able to take the files. Here is a screenshot of what I get:

    ErrorImage_1

    But also a questions pick up my CSS documents:

    ErrorImage_2.jpg

    I have a folder on my desktop with the index file as well as my css file, but I get this warning whenever I try to link the css file to the index.

    What gives here?

    Help!

    Jason Coleman

    Put your files in a root folder and define the site. You should always set your site. He keeps everything organized

    Here is a tutorial on how to do

  • Convert a Script Quark to InDesign

    I have an apple quarkXpress script I want to convert to InDesign. We really think hard on the conversion on InDesign, but one problem is that I have an apple script that automates much of the work. The script we use shaped text with style sheets and incorporates images in the text.  Any help would be greatly appreciated. Thank you

    It is possible both the format text using styles and place the images using AppleScript in InDesign, but applications have different object models. In addition, it is difficult to respond to your request without more information. Can you be more specific?

  • HTML "BOLD" text and regular on the Spark components with embeded fonts

    Hello!

    I took a quick glance to the textflow Flex 4 new (at least new to me).

    I use a spark textarea that is assigned to a style that uses a font embed, the problem is that when the textarea component renders the text marked in bold (using < span fontWeight = "bold" >) you lose the embeded font style.

    How to display bold text and text in the same text box using embeded fonts?

    Thanks in advance

    That's exactly what I was looking for:

    {@font-face}

    SRC:URL("..) ("/ assets/MyriadWebPro.ttf");

    fontFamily: myFont;

    embedAsCFF: true;

    }

    {@font-face}

    SRC:URL("..) /Assets/MyriadWebPro-bold.ttf");

    fontFamily: myFont;

    fontWeight: bold;

    embedAsCFF: true;

    }

    {@font-face}

    SRC:URL("..) /Assets/MyriadWebPro-italic.ttf");

    fontFamily: myFont;

    fontStyle: italic;

    embedAsCFF: true;

    }

    {.myPlainStyle}

    fontSize: 20;

    fontFamily: myFont;

    }

    {.myBoldStyle}

    fontSize: 20;

    fontFamily: myFont;

    fontWeight: bold;

    }

    {.myItalicStyle}

    fontSize: 20;

    fontFamily: myFont;

    fontStyle: italic;

    }

    so now I can put fonts on "myFont" style, and the Flash will be made to the police as a result.

    http://help.Adobe.com/en_US/Flex/using/WS2db454920e96a9e51e63e3d11c0bf69084-7f5f.html

    Nice!

  • Is there a way to get regular Microsoft Yahei fonts AND "BOLD" work in Indesign?

    I have been using the Microsoft Yahei font ("BOLD" and regular) for many Chinese brochures and had no trouble in Quark XPress. We have everything that we converted to InDesign, but I can't get two fat of police work. If I delete the police regular of my mac, indesign will be recognize the "BOLD" fonts, but it will not see the two policies at the same time. I tried to add the fonts in applications fonts folder, but this is not enough. The only solution I can think of is to add a line 0.4 for the regular police whenever I need the "BOLD", but it's not ideal. I also tried looking for another font to use, but it seems that Microsoft Yahei is the best for Chinese characters and symbols English characters as the registerd mark and mark symbol - but if someone knows another police who works and has a normal weight and "BOLD" Please advise.

    Thank you

    The blog post eugene designates may explain some of the reasons for which some fonts may not work, but not in this case!

    InDesign CS4:

    PDF:

    You can check which version of these YaHei fonts you have? Both of my friends are v.6.02 and comes with Windows 7 - if yours are the same, the problem lies in CS5.5.

  • convert html in return

    I have a Web site runninig online, I lost the original file in MS Publisher 98.

    Is there a way to convert the site Html. the original MS Publisher 98 file so that I can change it?

    Garypinns,

    Welcome to the Microsoft Answers community.

    I couldn't find converters that would work however (because it is already in the code), so my first inclination would be to think that it is impossible, however, I would transfer your question in the Discussion MS Publisher community just to be sure, as one of the experts in this field would be better suited to provide you with a solution.

    Please visit this link:

    Discussions in Publisher Web Design

    Good luck!

    Lisa
    Microsoft Answers Support Engineer
    Visit our Microsoft answers feedback Forum and let us know what you think.

Maybe you are looking for

  • Server failure?

    I was wondering if there is a problem with server now or if it's just my Apple TV. I tried to play an episode, but it says that the connection has been lost. I force restarted the Apple TV and now when you try to select a series, I just get "an unexp

  • 50g: algebraic programming with 50g

    I just bought a 50g after using the 20 more than 20 years.  I'm bored already 20 years. I am trying to program a formula simple interpolation using the procedure described on page 1-5 of the manual.  I use algebraic entry, and I use the method of "lo

  • Memory 1 GB module works is not on Satellite P10

    Hello worldI own satellite P10-304.According to the data provided by toshiba this model should support up to 2 GB of RAM (1 GB max in one piece). To be sure, I did a test online to check what type of memory is installed and what kind of memory will b

  • How to reinstall windows audio and endpoint windows audio

    Original title: I don't know what is my audio device by default? What it should be for Windows XP Professional. How can I reinstall windows audio and windows audio endpoint I deleted the files from my computer. They are not in the trash. It is empty.

  • Accidental erasure of hard drive

    I was helping a friend with their computer to Windows 8. He said he tried to pass to 8.1, but it glitched while downloading, restart, and he lost all his records. All its shortcuts were gone, but some programs were left untouched. The next day, he as