Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
R

RobertSF

@RobertSF
About
Posts
78
Topics
13
Shares
0
Groups
0
Followers
0
Following
0

Posts

Recent Best Controversial

  • Anyone seen this odd Word Interop behavior?
    R RobertSF

    I was going to delete this, but I'll leave it up in case someone else has the same problem. Here's the solution -- the call to Documents.Open has to have more arguments. The MS documentation says they're optional, but there are side-effects to not providing them.

    var wordApp = new Microsoft.Office.Interop.Word.Application();
    wordApp.Visible = false;
    Document wordDoc1 = wordApp.Documents.Add();
    Document wordDoc1a = wordApp.Documents.Add();
    Document wordDoc2 = wordApp.Documents.Open(@"c:\users\robertsf\desktop\doc2.docx",
    false, false, false, "", "", false, "", "", WdOpenFormat.wdOpenFormatAuto,
    MsoEncoding.msoEncodingUTF8, false, false, none, none, none);

    Now it works as expected. I haven't experimented to see exactly which argument caused the issue.

    C# csharp com json question

  • Anyone seen this odd Word Interop behavior?
    R RobertSF

    Using C# and Word 16.0.

            var wordApp = new Microsoft.Office.Interop.Word.Application();
            wordApp.Visible = false;
            Document wordDoc1 = wordApp.Documents.Add();
            Document wordDoc2 = wordApp.Documents.Open(@"c:\\users\\robertsf\\desktop\\doc2.docx");
    

    When this code executes, wordDoc1 gets clobbered, everything returning COM Exception, and wordApp.Documents contains only one object, the opened document.

            var wordApp = new Microsoft.Office.Interop.Word.Application();
            wordApp.Visible = false;
            Document wordDoc1 = wordApp.Documents.Add();
            Document wordDoc1a = wordApp.Documents.Add();
            Document wordDoc2 = wordApp.Documents.Open(@"c:\\users\\robertsf\\desktop\\doc2.docx");
    

    When this code executes, wordDoc1 gets clobbered again, but wordDoc1a is fine, and wordApp.Documents contains two objects.

            var wordApp = new Microsoft.Office.Interop.Word.Application();
            wordApp.Visible = false;
            Document wordDoc2 = wordApp.Documents.Open(@"c:\\users\\robertsf\\desktop\\doc2.docx");
            Document wordDoc1a = wordApp.Documents.Add();
    

    When this code executes, however, everything is fine. wordApp.Documentscontains two objects, and each object is accessible, as expected. I'm trying to programmatically create a new document and copy the text of a variable number of documents into it. I suppose I could open all the source documents before creating the destination document. Or I could try to create two instances of Word.Application, one for the source documents and one for the destination document, and then see if I can copy between the two instances. Here's the MS documation. Add: Documents.Add(Object, Object, Object, Object) Method (Microsoft.Office.Interop.Word) | Microsoft Learn[^] Open: Documents.Open Method (Microsoft.Office.Interop.Word) | Microsoft Learn[^<

    C# csharp com json question

  • How to seamlessly share code in Visual Studio?
    R RobertSF

    Thanks! I understand those concerns and, fortunately, it's nothing like that. I've always coded as a hobby and to make shorter work of my work at work. After many years in IT user support, I aged out and am now a legal secretary at a small law firm. The pay's just as good and I'm never on call! :laugh: I'm working on a document generation system based on Word template files. It would have no commercial value because case management software these days comes with that feature. It's just that our firm is too small for a full-blown case management system. It's like writing a basic word processor for your uncle who runs a business but can't afford MS Office.

    Windows Development csharp visual-studio hosting cloud tutorial

  • How to seamlessly share code in Visual Studio?
    R RobertSF

    Well, I guess up/downloading the project isn't a deal-breaker. Much better than carrying the USB around. Thanks!

    Windows Development csharp visual-studio hosting cloud tutorial

  • How to seamlessly share code in Visual Studio?
    R RobertSF

    Yeah, I guess that's the way to go. I'll look into it.

    Windows Development csharp visual-studio hosting cloud tutorial

  • How to seamlessly share code in Visual Studio?
    R RobertSF

    I have Visual Studio on two computers. One is at work, so my Microsoft account there is different from my Microsoft account on my computer at home. So far, I take my code back and forth by copying the folder for the solution I'm working on to a thumb drive and taking it with me. That's basically SneakerNet. I figured, with "the cloud" everywhere, there's some way I can set things up so both computers see the same code. I tried with GitHub, but I don't want to get into forks and pulls and what not. I'm not two different people with one suggesting changes to the other and the other approving the changes or not. I just want to access the same code from two different Visual Studio installations with a minimum of fuss. Any ideas? Thanks!

    Windows Development csharp visual-studio hosting cloud tutorial

  • Using blob fields to store PDFs -- good idea/bad idea?
    R RobertSF

    Where I work, they have thousands of PDFs used as exhibits at trial. From these they select the pertinent ones for the trial at hand, and off they go. It's a pain every time to find the ones they want, so I plan to write a little app to act as interface and store the attributes of each exhibit for easier searching. My design decision here is whether to store the path and name of the PDF in the database, and then retrieve the PDF when necessary, or to actually store the PDF in the database as a blob. What are the implications of storing the PDFs as blobs? Is there a big performance hit? Once stored, the PDFs won't be edited, so it's just passive storage. Do blobs increase the risk of corruption and data loss?

    Database database design algorithms performance question

  • Twitter Accepts Musk's Bid
    R RobertSF

    I read this could mark the end of Twitter and the start of serious regulation of social media. The theory is that Musk will let Twitter descend into such a cesspool that people will leave it and things will come to the attention of Congress. Could just be wishful thinking. We'll see.

    The Lounge com

  • Twitter Accepts Musk's Bid
    R RobertSF

    Sander Rossel wrote:

    If you want to solve the problem, you have to be able to question these things.

    The problem is that, while you're just "asking questions," it's clear that you're not seeking any answers that don't boil down to "there's something inherently wrong with black people." And no, it's no good to say it's a "cultural" problem. Where do you think subcultures comes from? They are formed under the pressures of the dominant culture. Yes, black people commit more violent and petty crime, but white people commit more financial crime, and you never hear much about that. White people took down the whole US economy in 2008, and nobody went to prison. But knock over a 7/11 and you get $237 from the register and 10 years from the judge. Funny how politicians never run on "taking down the criminals who steal your pensions." It's so much easier to run on, "I'll save you from having your TV stolen by *whistle* urban burglars." Here's another thing to ponder. Notice how white people have the luxury that all their bad apples are just individual bad apples. When you say that white people took down the US economy in 2008, you get skeptical looks. It wasn't white people. It was some white individuals. But that's just the thing. When it comes to black people, everything bad one of them does is instantly credited to the entire race. If you're white and late for work, it's because you're late. If you're black and late for work, it's because you're black. it's black men, more specifically. Then again, what opportunities does your average black man have in this society? Suppose he sits still in highschool and gets his diploma. Then what? A life of minimum-wage work in retail (where women are favored for employment, by the way, for a number of reasons).

    The Lounge com

  • Bye-bye, MS Office!
    R RobertSF

    I used MS Office since the early 1990s, always thanks to the volume discounts my employers got. But then my Office Pro 2016 got munged, and I had to factory-reset my PC, and now my options are $400-something for a standalone version of Office or $100 a year for Office 365. Obviously, Office 365 is the far better deal, but then I asked myself if I needed Office. Looks like I don't. I've installed Thunderbird for email, and that works fine. I use Access in application development because it has a nice interface, but I can do the same with SQLite and "DB Browser for SQLite." If I need to open Word or Excel files, it looks like Google Docs and even Microsoft's free web-based Office apps can do the trick. How about you?

    The Lounge sharepoint database sqlite question announcement

  • Comparison of 2 Web Hosts
    R RobertSF

    raddevus wrote:

    Would you mind trying it and letting me know what you get for each site? 1) WinHost Site: Test Load Speed[^] 2) SmarterASP.net site: Test Load Speed[^]

    Well, I didn't get such bad results. The first, via newlibre.com

    Testing Load Speed
    beginTime: Tue Apr 05 2022 15:33:57 GMT-0700 (Pacific Daylight Time)
    endTime: Tue Apr 05 2022 15:34:01 GMT-0700 (Pacific Daylight Time)
    3.721 seconds elapsed during load.

    The second, via cyapass.com

    Testing Load Speed
    beginTime: Tue Apr 05 2022 15:33:50 GMT-0700 (Pacific Daylight Time)
    endTime: Tue Apr 05 2022 15:33:52 GMT-0700 (Pacific Daylight Time)
    2.036 seconds elapsed during load.

    The Lounge csharp asp-net com data-structures sales

  • Are lightweight CMS still around?
    R RobertSF

    Yes, apparently. I also found a German CMS called phpwcms, but I don't think development is active.

    Web Development php python database wpf json

  • Dog surgery
    R RobertSF

    Good luck to Grizzly! Glad to hear he has a good human.

    The Lounge

  • MS Office bla bla bla
    R RobertSF

    I admit the change to the Ribbon interface all but killed my expertise in Office. The Ribbon is apparently the result of Microsoft Marketing conducting endless focus groups, but I think it violates common-sense rules of UI design. One such rule is that the interface shouldn't change, but the Ribbon changes according to the width of the application window.

    The Lounge

  • To all you Wordle players...
    R RobertSF

    Well, there's Word Hippo's Word Finder. The Ultimate Word Finder & Unscrambler - Wordle Helper & Cheats[^]

    The Lounge javascript cloud csharp linq com

  • Why are some forums so dead?
    R RobertSF

    I mean, there's like, nothing, in Web Development for weeks and weeks. Does nobody here do any web development? Or are all such experts that they have no questions? :laugh:

    The Lounge question

  • Something I noticed about C++ code
    R RobertSF

    honey the codewitch wrote:

    Where is all the modern C++ code?

    Right next to the modern COBOL code. :-D

    The Lounge c++ question

  • how sort datgridview or listview like windows explorer
    R RobertSF

    One solution is to create a class for a "sortable" list and use that as your data source in the DGV. I found this somewhere and have been using it with success. Thanks to the unsung hero who wrote it.

    using System;
    using System.Collections.Generic;
    using System.ComponentModel;
    using System.Linq;
    using System.Runtime.InteropServices;

    namespace YourNamespace
    {
    internal static class NativeMethods
    {
    [DllImport("shlwapi.dll", CharSet = CharSet.Unicode)]
    internal static extern int StrCmpLogicalW(string aString, string bString);
    }

    internal class SortableList : BindingList
    {
        protected override bool SupportsSortingCore
        {
            get
            {
                return true;
            }
        }
    
        protected override void ApplySortCore(PropertyDescriptor prop, ListSortDirection direction)
        {
            int modifier = direction == ListSortDirection.Ascending ? 1 : -1;
            if (prop?.PropertyType.GetInterface("IComparable") != null)
            {
                var items = Items.ToList() as List;
                items.Sort(new Comparison((a, b) =>
                {
                    var aVal = prop.GetValue(a).ToString() as string;
                    var bVal = prop.GetValue(b).ToString() as string;
                    return NativeMethods.StrCmpLogicalW(aVal, bVal) \* modifier;
                }));
                Items.Clear();
                foreach (var i in items) Items.Add(i);
            }
        }
    }
    

    }

    C# help

  • It's a lot today: File Explorer rant
    R RobertSF

    Exactly. They charged a premium for a computer for people who can't type.

    The Lounge com design data-structures question

  • Epson punk'd me: so funny (not!)
    R RobertSF

    Yeah, but that's just bad product packaging. You shouldn't have to read the fine print to buy an ink cartridge.

    The Lounge com data-structures question
  • Login

  • Don't have an account? Register

  • Login or register to search.
  • First post
    Last post
0
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups