.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
Sign In
Win Surprise Gifts!!!

Top 5 Contributors of the Month
david stephan
Gaurav Pal
Post New Web Links

RichTexBox/FlowDocument Macro Recording

Posted By:      Posted Date: September 27, 2010    Points: 0   Category :WPF



I would like to easily record the changes made to the of RichTextBox (user and/or programmatic) as well as the changes made to the FlowDocument and be able to save and play them again.

I was thinking about the do/undo queue of the document. How do I get access to it?

Also, can UIAutomation or something like this can help me?

In short, can you to me what my options are? 



View Complete Post

More Related Resource Links

Create And Run Excel Macro At Runtime in C#

You've been tasked with writing a Windows Form application using the .NET Framework that interacts with Microsoft Excel. If you are new to working with Excel in .NET and are having trouble learning how to format certain cells or cell ranges, then this little tip will come in handy. Rather than scour the internet hoping to find the correct set of constants or method syntax for formatting your spreadsheet, use the built in tools in Excel to write the familiar VBA code for you. Then, you can paste the VBA code generated by Excel into the sample C# code below and run it dynamically at runtime.

Office Space: From VBA Macro to Word Add-in


See how to use Word to capture a VBA macro and use Visual Studio Tools for Office to wrap it up into a deployable Word add-in.

Robert Bogue

MSDN Magazine May 2008

Disable XAML Intellisense in Macro (VS2010 IDE)

I'm writing a few macros to insert XAML code I often use into the VS2010 XAML editor. This works OK, but Intellisense is interpreting the code as it's being inserted. This causes syntax errors. Here's an example of the inserted code: <Grid> <Grid.RowDefinitions> <RowDefinition></RowDefinition> </Grid.RowDefinitions> <Grid.ColumnDefinitions> <ColumnDefinition></ColumnDefinition> </Grid.ColumnDefinitions> </Grid> The inserted code is a bit more complex as it includes properties I commonly use, but this will help illustrate the problem.When the code is inserted, Intellisense completes the definitions. For example, after <Grid> is inserted, Intellisense adds a corresponding </Grid>, which makes the code syntatically incorrect.How can I automatically disable Intellisense before the code is inserted and enable it after (within the macro)? After the code is inserted, I'd like to automatically reformat it.Thanks!

Trigger a macro anytime a site or web is opened in SharePoint Designer

Within SharePoint Designer (not interfacing with SharePoint services), I would like to have a macro automatically run anytime a web is opened. I assume I need to use the OnWebOpen VBA event but I'm not sure how to write this into a module. Is there any chance someone could assist me with what this sub routine should look like? Thank you! Greg

automating excel macro using C#

runing a excel macro from C# window application

Macro's won't run in Visual Studio 2010

I have them enabled in tools, can see the macros, run is an option, but nothing happens when I run them.   Any ideas? 

run excel macro from asp page

Guys...here is my code. it doesn't give any error when i invoke a simple macro from C#. but i don't see any result. all i'm doing in macro is fill some cells Sub firstmacro() Dim i As Integer For i = 10 To 20 For j = 1 To 1 Cells(i, j) = i + 10 Next j Next i End Sub             Excel.Application m_objExcel = new Excel.ApplicationClass();             m_objExcel.Visible = true;                         Excel.Workbook wb = m_objExcel.Workbooks.Open(fName, 0, true, 5, "", "", true,                 Excel.XlPlatform.xlWindows, "", false, false, 0, true);             //m_objExcel.GetType().InvokeMember("firstmacro", BindingFlags.Public, null, null, null);             //m_objExcel.Run("firstmacro");                 //null, null, null, null, null,     null, null, null, null, null,                 //null, null, null, null, null,     null, null, null, null, null,        

Saving Document With Column items applied via excel macro

I have an excel macro that pulls data down from columns within worksheets that will take an excel spreadsheet and save it as a PDF file into seperate folders based off criteria set in the files. Getting the files into the proper directory is not the problem i'm having. When the script executes it saves the documents directly to our sharepoint site, but the custom columns A B C D etc are all blank and some are 'required' items which sets the document as checked out until i go into the list and enter the required data. Is there anyway to make this macro export as PDF and set the required data for me in the sharepoint column so it checks the documents in for me? I'm figuring this is a simple set of meta datatags but I don't know the syntax for them and I didn't find anything like this on the forum anywhere else. ActiveSheet.ExportAsFixedFormat Type:=xlTypePDF, Filename:= _ "http://DirectoryStructureHere/corporate%20BoFi/pdfs/" & NewFileName & ".pdf" _ , Quality:=xlQualityStandard, IncludeDocProperties:=True, IgnorePrintAreas _ :=False, OpenAfterPublish:=False 'Exports the print area as a PDF document named the new filename "Modified: to sharepoint"

Underline Property in FlowDocument

Hi, I am trying to find whether a text in in a flowdocument object is underlined or not. What I did, I broke up the flowdocument object into a list of Run. I am looping through each run and checking the properties of the run. But I could not find how to get the underline proerty of the run is. It is not in TextDecoratuions. Can you please help? Regards,Sayan Chatterjee | Senior Consultant | PricewaterhouseCoopers India

Textrange.Load not loading Xaml code into a FlowDocument


I'm trying to convert text with Xaml tags into a FlowDocument.  I've done this before and it worked fine (as far as I can recall - that was about a year ago.)  Now I can't get this to work:

private Span FormatString(String _textToFormat)
    FlowDocument _formattedDocument;
    Span _formattedText;

    _myString = "<FlowDocument xmlns=\"http://schemas.microsoft.com/winfx/2006/xaml/presentation\"><Paragraph>This is some <Run FontWeight=\"bold\">bold</Run> text.</Paragraph></FlowDocument>";

    _formattedDocument = new FlowDocument();
    _formattedText = new Span();

    TextRange textRange = new TextRange(_formattedDocument.ContentStart, _formattedDocument.ContentEnd);

    MemoryStream msDocument = new MemoryStream((new ASCIIEncoding()).GetBytes(_myString));
    if (textRange.CanLoad(DataFormats.Xaml))
        textRange.Load(msDocument, DataFormats.Xaml);

// rest of function trimmed - the problem is above

Things work fine up to and including the creation of the MemoryStream (inspection with the debugger shows that the bytes are in there.)  "textRange.CanLoad" also resolves to true, but textRange.Load(msDocument, DataFormats.Xaml) doesn't seem to do anything - after that, a look at "textRa

problem in converting a flowdocument in a xps document



I have a flow document that contains different paragraphs.

Each paragraph contains an inlineuielement.

The flowdocument looks fine but when i try to convert it in a xps  i get a document

where all the inliuielemnts elements are not displayed one after the other down the column

but they overlap partially.



 any idea why i have  this behaviour?



Webcam streaming and recording in asp.net


Hi everyone I want to know about Webcam streaming over the web using c# and asp.net by using multiple cameras.I am unable to do this.So please help me out so that i can implement my application.I am able to stream by using single camera.

Unexpected errors occurred while running Macro


I get this error when moving(saving) to the next row when I create a new Project in the Open Project Tab in a Web Project Database site.

Environment: SharePoint 2010 Farm implementation

Looking in the event log here is the error that is logged in there

Error loading and running event receiver Microsoft.Office.Access.Server.AccessServicesListEventReceiver in Microsoft.Office.Access.Server.Application, Version=, Culture=neutral, PublicKeyToken=71e9bce111e9429c. Additional information is below.

: "Microsoft.Office.Access.Server.Quickflow.Runtime.QuickflowContext, Microsoft.Office.Access.Server.Application, Version=, Culture=neutral, PublicKeyToken=71e9bce111e9429c" is not a type authorized for use in this workflow.


Any help would be appreciated

View Flowdocument XAML at runtime


Hi, I have a richtextbox with an embedded flow document such as:

    <RichTextBox Name="richTextBox1">
      <FlowDocument x:Name="fdMain">
        <Paragraph>Paragraph Text</Paragraph>
At runtime I am programatically adding new paragraphs, and formatting text etc. Is there a way I can display the xaml of the richtextbox (and, hence, flowdocument) as it is updated at runtime?



Only one page of a very long FlowDocument ever gets printed?


I'm at a loss.  

Let's say you have a FlowDocumentReader.  It contains a FlowDocument that is, say, 33 inches long.

I use the Print() method on the reader to print the contained FlowDocument.  I select 8.5x11 as my page length.

Only one page prints, not three.


What am I missing?  Why do the WPF printing gods hate me so damned much?

Cannot load macro project - invalid or inaccessible macro project file


This error pops up the first time a macro is invoked after starting Visual Studio 2008.

Cannot load macro project "" for the following reason:

'H:\mydocuments\Visual Studio 2008\Projects\VSMacros80\MyMacros\MacroProject1\MacroProject1.vsmacros' is an invalid or inaccessible macro project file

This began after I created and deleted a macro project called MacroProject1. I have tried removing the following two related registry keys, but they get recreated automatically:

  • HKEY_CURRENT_USER\Software\Microsoft\VSA\9.0\ProjectMRUList\File3:

    Data: vsmacros://H%3A/mydocuments/Visual%20Studio%202008/Projects/VSMacros80/MyMacros/MacroProject1/MacroProject1.vsmacros|{13B7A3EE-4614-11D3-9BC7-00C04F79DE25}
  • HKEY_CURRENT_USER\Software\Microsoft\VisualStudio\9.0\vsmacros\OtherProjects7\1

    Data: Path: H:\mydocuments\Visual Studio 2008\Projects\VSMacros80\MyMacros\MacroProject1\MacroProject1.vsmacros






ASP.NetWindows Application  .NET Framework  C#  VB.Net  ADO.Net  
Sql Server  SharePoint  Silverlight  Others  All   

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend