none
How to get to access to the ".aspx" code that i've copied into a word document, can only get the Web View access RRS feed

  • Question

  • Hello, i would like to document an ".aspx" web page by copying the ".aspx" code into a word document and then adding comments and links ect.

    Ok so i copied the ".aspx" code into the document and called it "test.aspx.docx", but when i select the word document, i can only get a view of the actual web page view, which is great for documentation purposes as well, but i can't seem to find a way to get access to the actual ".aspx" code when its in the word document, in order to add those comments and ect.

    Thanks very much for any suggestions or pointers.

    bk       

    Friday, October 28, 2011 11:16 AM

Answers

  • Ok i found them under AppData/Microsoft/Templates, thanks again Cindy!

    bk

    • Marked as answer by bobk544 Monday, October 31, 2011 1:55 PM
    Monday, October 31, 2011 1:55 PM

All replies

  • Hi bk

    I think you need to give us more specifics about how you're doing this. For example, do you start Word as an end-user, copy the code in Visual Studio, switch back to Word and paste? Or are you doing something else?

    When you open the document later to look at what you pasted into it, are you starting the Word application as a stand-alone and selecting the document from File/Open, or something else?

    The docx file format is the same file format that WPF uses to package content. I can imagine, if you're not using Word as a stand-alone application, that something is "seeing" the aspx and interpreting that...


    Cindy Meister, VSTO/Word MVP
    Saturday, October 29, 2011 8:08 AM
    Moderator
  • Thanks for responding Cindy, well i simply going into the application directory, opening an ".aspx" file with notepad, selecting all, and then opening a blank word document from scratch and then pasting that copied ".aspx" script code right into the word document. And when i then just open the word document by selecting the word document, it then automatically interprets the ".aspx" script just like you're saying, and then shows sort of a mock up of the ".aspx" page as if it were a web page minus the css scipting i think cos is scrunches the ".aspx" components into one corner and therefore you don't see the formatted view of the ".aspx" script components.

    But what i would like to figure out is, when i'm looking at that web interpretation of the ".aspx" code, i would like to select a word feature like "normal view" or something like that which would allow me to treat that ".aspx" code like regular text, so what i did yesterday was to create a ".txt" view along side the word/web view just for the near term documenation effort and i'm now exploring maybe vba approach, where i would select a macro and change all the word contents web characters ie from "<" to "[" or something like that, but i'm sure there must be a way to simply turn off the web interpreter and treat all content as text, but maybe not, anyway i still really like the fact that it is showing the web interpreted view, that will be good for documentation.

    Ok thanks very much for spending your time helping me out on this, have a nice weekend and if you happen to think of any jerririgged workarounds i'm all ears!

    bk

    Saturday, October 29, 2011 5:41 PM
  • Hi bk

    Thing is, I've never seen or heard of what you describe (and I don't program aspx so I can't try to duplicate what you've done). If you could upload such a beast somewhere, I'd be really curious to look at it...

    As it is, I'm only able to make suggestions. One of these would be to try renaming the file to remove .aspx from the file name.

    Another would be to make sure that the option "Confirm Conversions on Open" is turned on(File/Options/Advanced, category "General") so that you can see what file type Word thinks it's working with (and try choosing another, more appropriate one).

    As far as I know, Word should simply be saving what you paste in as text in the <w:body> element of the /word/document.xml part of the docx file. And when Word opens the file, it should be finding the relationship that tells it this is a Word document. But if that aspx in the document name is triggering Word to use some other kind of file format...

    And this is stand-alone Word, not part of Office 365 or Office Live?


    Cindy Meister, VSTO/Word MVP
    Sunday, October 30, 2011 4:12 PM
    Moderator
  • Ok thanks again Cindy, yes it is very strange and i've tried just about everything and the only tool that allows me to look at the actual ".aspx" code itself in the right indented format is notepad++, so i'm going to keep tooling around with that as notepad++ apparently knows the format and thanks for that the "Confirm Conversions on Open" suggestion, that's very interesting, didn't know you could set that that way and it does allow me to look at the actual text, instead of the web aspx view, but i lose the indenting, but i'm getting closer!

    here's a snippet of the aspx code and if you paste it into a word document you may see what i'm talking about:

    <%@ Page Language=""VB"" AutoEventWireup=""false"" CodeFile=""Analysis.aspx.vb"" Inherits=""ConObsAnalysis"" ValidateRequest=""false"" %>
    <%@ Register Assembly=""Telerik.Web.UI"" Namespace=""Telerik.Web.UI"" TagPrefix=""telerik"" %>
    <!DOCTYPE html PUBLIC ""-//W3C//DTD XHTML 1.0 Transitional//EN"" ""http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"">
    <html xmlns=""http://www.w3.org/1999/xhtml"">
    <head runat=""server"">
        <title>CO Terms and Conditions</title>
        <link type=""text/css"" rel=""Stylesheet"" href=""OFAnalysis.css"" />
        <link type=""text/css"" rel=""stylesheet"" href=""RadControls/Grid.BFCAgrid.css"" />               
    </head>
    <body>
        <form id=""form1"" runat=""server"">
        <script type=""text/javascript"">
            function OnRequestStart(sender, arguments) {
                document.getElementById('btnSearch').disabled = true;
                document.getElementById('divGrid').disabled = true;
            };
            function OnResponseEnd(sender, arguments) {
                document.getElementById('btnSearch').disabled = false;
                document.getElementById('divGrid').disabled = false;
            };
       
            function ShowBond(CUSIPID) {
                var oWindow = top.radopen(""Bond.aspx?ID="" + CUSIPID, null);
                var wWidth = top.document.body.offsetWidth * 0.9
                var wHeight = top.document.body.offsetHeight * 0.9
                var oMarginLeft = (top.document.body.offsetWidth - wWidth) / 2;
                var oMarginTop = (top.document.body.offsetHeight - wHeight) / 2;
                oWindow.MoveTo(oMarginLeft, oMarginTop);
                oWindow.SetSize(wWidth, wHeight);
                return false;
            }
            function DisplayFHLBankReport() {
                var dlFHLBank2 = document.getElementById(""dlFHLBank2"");
                var dlExtractDate = document.getElementById(""dlExtractDate"");

                var sFHLBank = dlFHLBank2.options<dlFHLBank2.selectedIndex>.value;
                var sConObsID = dlExtractDate.options<dlExtractDate.selectedIndex>.value;

                sURL = ""ExcelExport.aspx?Type=conobsfhlbank&FHLBank="" + sFHLBank + ""&ID="" + sConObsID;
                document.location.href = sURL;
            }
        </script>
        <telerik:RadScriptManager ID=""RadScriptManager1"" runat=""server""></telerik:RadScriptManager>
        <telerik:RadAjaxManager ID=""RadAjaxManager1"" runat=""server"" UpdatePanelsRenderMode=""Inline"" ClientEvents-OnRequestStart=""OnRequestStart"" ClientEvents-

    OnResponseEnd=""OnResponseEnd"">
    <ClientEvents OnRequestStart=""OnRequestStart"" OnResponseEnd=""OnResponseEnd""></ClientEvents>
            <AjaxSettings>
                <telerik:AjaxSetting AjaxControlID=""btnSearch"">
                    <UpdatedControls>
                        <telerik:AjaxUpdatedControl ControlID=""lnkPolypathsExport"" />
                        <telerik:AjaxUpdatedControl ControlID=""lnkXMLExport"" />
                        <telerik:AjaxUpdatedControl ControlID=""lblResults"" />
                        <telerik:AjaxUpdatedControl ControlID=""gridCUSIPs""
                            LoadingPanelID=""RadAjaxLoadingPanel1"" />
                    </UpdatedControls>
                </telerik:AjaxSetting>
                <telerik:AjaxSetting AjaxControlID=""gridCUSIPs"">
                    <UpdatedControls>
                        <telerik:AjaxUpdatedControl ControlID=""gridCUSIPs"" />
                    </UpdatedControls>
                </telerik:AjaxSetting>

            </AjaxSettings>
                   
        </telerik:RadAjaxManager>   
        <div>
            <div style=""float:right; display:inline;"">
                <a href=""Documents/DRMCOTC.pdf"" target=""_blank"">Download DRM</a><br />
                <a href=""Documents/ConObsBenchmarks.xls"" target=""_blank"">Download Benchmarks</a><br />
                <a href=""Documents/Codes.xls"" target=""_blank"">Download Codes</a>
            </div>
            <h3>CO Terms and Conditions</h3>
        </div>
        <div>
        <asp:Panel ID=""Panel1"" runat=""server"" DefaultButton=""btnSearch"">
            <table cellspacing=""0"" cellpadding=""1"" border=""0"">
                <tr>
                    <td>Data Extraction:</td>
                    <td><asp:DropDownList ID=""dlConObsData"" runat=""server"" Width=""200px""></asp:DropDownList></td>
                    <td style=""padding-left:15px;"">CUSIP Nbr:</td>
                    <td><asp:TextBox ID=""txtCUSIPNbr"" runat=""server""  Width=""195px""></asp:TextBox></td>
                    <td style=""padding-left:15px;"">Bond Type:</td>
                    <td>
                        <asp:DropDownList ID=""dlBondType"" runat=""server"" Width=""200px"">
                            <asp:ListItem Value="""" Text=""""></asp:ListItem>
                            <asp:ListItem Value=""BLLT"" Text=""Bullet""></asp:ListItem>
                            <asp:ListItem Value=""CPLX"" Text=""Complex""></asp:ListItem>
                            <asp:ListItem Value=""CALL"" Text=""Callable""></asp:ListItem>
                            <asp:ListItem Value=""Other"" Text=""Other""></asp:ListItem>
                            <asp:ListItem Value=""FLTR"" Text=""Simple Floater""></asp:ListItem>
                            <asp:ListItem Value=""All"" Text=""All""></asp:ListItem>
                        </asp:DropDownList>
                    </td>
                </tr>
                <tr>
                    <td>Rate Type:</td>
                    <td>
                        <asp:DropDownList ID=""dlRateType"" runat=""server"" Width=""200px"">
                            <asp:ListItem Value="""" Text=""""></asp:ListItem>
                            <asp:ListItem Value=""Fixed"" Text=""Fixed""></asp:ListItem>
                            <asp:ListItem Value=""Variable"" Text=""Variable""></asp:ListItem>
                            <asp:ListItem Value=""Conversion"" Text=""Conversion""></asp:ListItem>
                        </asp:DropDownList>               
                    </td>
                    <td style=""padding-left:15px;"">Rate Sub-Type:</td>
                    <td>
                        <asp:DropDownList ID=""dlRateSubType"" runat=""server"" Width=""200px"">
                            <asp:ListItem Value="""" Text=""""></asp:ListItem>
                            <asp:ListItem Value=""Other"" Text=""Other""></asp:ListItem>
                            <asp:ListItem Value=""Range"" Text=""Range""></asp:ListItem>
                            <asp:ListItem Value=""Step Up"" Text=""Step Up""></asp:ListItem>
                            <asp:ListItem Value=""Constant"" Text=""Constant""></asp:ListItem>
                            <asp:ListItem Value=""Step Down"" Text=""Step Down""></asp:ListItem>
                            <asp:ListItem Value=""Zero Coupon"" Text=""Zero Coupon""></asp:ListItem>
                            <asp:ListItem Value=""Step Up/Down"" Text=""Step Up/Down""></asp:ListItem>
                            <asp:ListItem Value=""Capped Floater"" Text=""Capped Floater""></asp:ListItem>
                            <asp:ListItem Value=""Inverse Floater"" Text=""Inverse Floater""></asp:ListItem>
                            <asp:ListItem Value=""Ratchet Floater"" Text=""Ratchet Floater""></asp:ListItem>
                            <asp:ListItem Value=""Stepped Floater"" Text=""Stepped Floater""></asp:ListItem>
                            <asp:ListItem Value=""Dual Index Floater"" Text=""Dual Index Floater""></asp:ListItem>
                            <asp:ListItem Value=""Single Index Floater"" Text=""Single Index Floater""></asp:ListItem>
                            <asp:ListItem Value=""Leveraged/Deleveraged"" Text=""Leveraged/Deleveraged""></asp:ListItem>                       
                        </asp:DropDownList>               
                    </td>
                    <td style=""padding-left:15px;"">Option Type:</td>
                    <td>
                        <asp:DropDownList ID=""dlOptionType"" runat=""server"" Width=""200px"">
                            <asp:ListItem Value="""" Text=""""></asp:ListItem>
                            <asp:ListItem Value=""Putable"" Text=""Putable""></asp:ListItem>
                            <asp:ListItem Value=""Non-Callable"" Text=""Non-Callable""></asp:ListItem>
                            <asp:ListItem Value=""Indexed Amortizing Note"" Text=""Indexed Amortizing Note""></asp:ListItem>
                            <asp:ListItem Value=""Scheduled Amortizing Note"" Text=""Scheduled Amortizing Note""></asp:ListItem>
                            <asp:ListItem Value=""Optional Principal Redemption"" Text=""Optional Principal Redemption""></asp:ListItem>
                        </asp:DropDownList>                               
                    </td>
                </tr>
                <tr>
                    <td>Placement Type:</td>
                    <td>
                        <asp:DropDownList ID=""dlPlacementType"" runat=""server"" Width=""200px"">
                            <asp:ListItem Value="""" Text=""""></asp:ListItem>
                            <asp:ListItem Value=""Negotiated"" Text=""Negotiated""></asp:ListItem>
                            <asp:ListItem Value=""Competitive Bid"" Text=""Competitive Bid""></asp:ListItem>
                            <asp:ListItem Value=""Competitive Negotiated"" Text=""Competitive Negotiated""></asp:ListItem>
                            <asp:ListItem Value=""Term Capital Auction"" Text=""Term Capital Auction""></asp:ListItem>
                            <asp:ListItem Value=""As Agent"" Text=""As Agent""></asp:ListItem>
                            <asp:ListItem Value=""Private Placement"" Text=""Private Placement""></asp:ListItem>
                        </asp:DropDownList>                               
                    </td>
                    <td style=""padding-left:15px;"">Issue Market:</td>
                    <td>
                        <asp:DropDownList ID=""dlIssueMarket"" runat=""server"" Width=""200px"">
                            <asp:ListItem Value="""" Text=""""></asp:ListItem>
                            <asp:ListItem Value=""Domestic"" Text=""Domestic""></asp:ListItem>
                            <asp:ListItem Value=""Global"" Text=""Global""></asp:ListItem>
                        </asp:DropDownList>                                               
                    </td>
                    <td style=""padding-left:15px;"">CallStyle:</td>
                    <td>
                        <asp:DropDownList ID=""dlCallStyle"" runat=""server"" Width=""200px"">
                            <asp:ListItem Value="""" Text=""""></asp:ListItem>
                            <asp:ListItem Value=""American"" Text=""American""></asp:ListItem>
                            <asp:ListItem Value=""Bermudan"" Text=""Bermudan""></asp:ListItem>
                            <asp:ListItem Value=""Canary"" Text=""Canary""></asp:ListItem>
                            <asp:ListItem Value=""European"" Text=""European""></asp:ListItem>
                            <asp:ListItem Value=""Multi-European"" Text=""Multi-European""></asp:ListItem>
                        </asp:DropDownList>                                                               
                    </td>
                </tr>
                <tr>

    thanks again Cindy!

    bk

    Monday, October 31, 2011 1:33 AM
  • Hi bk

    Well, I copied the aspx lines of code into a new Word document. Saved it as test.asp.docx, closed and opened it again...

    And what I see when I open is exactly what I saw when I closed the document. Which is what I would expect. So something else is going on on your system, perhaps you have some kind of "aspx editing" add-in installed? Document management system? No idea. I've never heard of anything like this happening before, so all I can do is guess.

    One way to test whether that may be a factor would be to hold CTRL when starting Word, to force it into Safe Mode. That will run Word with the installation defaults. Then try pasting in code, saving, closing, re-opening (all in the same Safe Mode session). Does that give you a different result?

    Anyway. When I paste this in Word the indents are made by space characters, not tabs or Word indents. If you do have some kind of add-in running that works XML-based then it appears to not preserve white-space.

    You could run a Find/Replace to replace n spaces with a tab character. To test whether that would help at all, just select some spaces delete, then press TAB. Save, close, etc. (Note: in order to see non-printing characters such as spaces and tabs, click the "backwards P" button in the paragraph group of the Home tab.)

    It would also be possible to create a macro that substitutes a "real" Word indent for the spaces at the beginning of each paragraph (the most stable solution if you're writing documentation). Even better, from a professional word-processing POV, would be to create and apply a styles for each indent-level...


    Cindy Meister, VSTO/Word MVP
    Monday, October 31, 2011 6:59 AM
    Moderator
  • Ok that's good news Cindy, so yes there is probably a setting on my end that needs to be turned off, so that's very encouraging and thanks very much for testing that out!

    Have a great week Cindy and i'm going to close this out knowing there is a  solution!

    bk

    • Marked as answer by bobk544 Monday, October 31, 2011 12:25 PM
    • Unmarked as answer by bobk544 Monday, October 31, 2011 12:25 PM
    • Marked as answer by bobk544 Monday, October 31, 2011 12:25 PM
    • Unmarked as answer by bobk544 Monday, October 31, 2011 1:20 PM
    Monday, October 31, 2011 12:25 PM
  • Hi Cindy, i'm wondering if i might have switched something off in the process of fiddling around with Word settings, but now my macros have dissappeared and i don't see them in the "normal.dotm" directory, do you know if there is a settings that's associated with this per chance?

    Thanks again Cindy

    bk

    Monday, October 31, 2011 1:22 PM
  • Ok i found them under AppData/Microsoft/Templates, thanks again Cindy!

    bk

    • Marked as answer by bobk544 Monday, October 31, 2011 1:55 PM
    Monday, October 31, 2011 1:55 PM