小编Sar*_*rah的帖子

如何在excel表中获取被占用单元格的范围

我使用C#来自动化excel文件.我能够获得它包含的工作簿和工作表.例如,我在sheet1中有两个cols和5行.我希望o获得被占用单元格的范围为A1:B5.我尝试了以下代码,但没有给出正确的结果.列#和行#更大,单元格也是空的.

     Excel.Range xlRange = excelWorksheet.UsedRange;
     int col = xlRange.Columns.Count;
     int row = xlRange.Rows.Count;
Run Code Online (Sandbox Code Playgroud)

有没有其他方法可以用来获得该范围?

c# excel automation

35
推荐指数
3
解决办法
10万
查看次数

如何让iPhone应用程序多次要求注册设备进行推送通知

我使用以下代码注册我的应用程序以接收推送通知,我收到警告,要求我注册推送通知,我不小心按下取消.现在我想再次发出警报,以便我可以触发委托方法以获取设备令牌.但是我不再收到此警报,每次打开设置时我都会发现应用程序的通知已关闭.我试图从设备删除应用程序,更改应用程序版本,删除测试配置文件,清理目标甚至我重置所有的iPhone设置,但仍然无法解决这个问题.我非常感谢任何帮助,谢谢

[[UIApplication sharedApplication] registerForRemoteNotificationTypes:
     UIRemoteNotificationTypeBadge | 
     UIRemoteNotificationTypeAlert | 
     UIRemoteNotificationTypeSound];  
Run Code Online (Sandbox Code Playgroud)

iphone push-notification apple-push-notifications devicetoken

8
推荐指数
2
解决办法
1万
查看次数

从.NET使用Python COM服务器

我想使用win32com扩展来实现python com服务器.然后从.NET中使用服务器.我使用以下示例来实现com服务器并且它运行没有问题但是当我尝试使用C#消耗它时,我得到了FileNotFoundException并带有以下消息"使用CLSID检索组件的COM类工厂{676E38A6-7FA7-4BFF-9179 -AE959734DEBB}由于以下错误而失败:8007007e." .我也发布了C#代码.我想知道我是否遗漏了一些我会感激任何帮助.

谢谢,莎拉

#PythonCOMServer.py

import pythoncom
class PythonUtilities:
    _public_methods_ = [ 'SplitString' ]
    _reg_progid_ = "PythonDemos.Utilities"
    # NEVER copy the following ID

    # Use"print pythoncom.CreateGuid()" to make a new one.
    _reg_clsid_ = pythoncom.CreateGuid()
    print _reg_clsid_
    def SplitString(self, val, item=None):
        import string
        if item != None: item = str(item)
        return string.split(str(val), item)

# Add code so that when this script is run by
# Python.exe,.it self-registers.

if __name__=='__main__':        
    print 'Registering Com Server'
    import win32com.server.register
    win32com.server.register.UseCommandLine(PythonUtilities)


// the C# code …
Run Code Online (Sandbox Code Playgroud)

.net python com

5
推荐指数
1
解决办法
4196
查看次数

使用Cocoa-Touch将iOS文件转换为PDF文档

我想将iPhone上的本地html文件转换为PDF文档.我使用了我在网上找到的以下代码从Picture生成PDF文件,我试图用html文件替换图像,但它失败了.我非常感谢你的帮助.提前致谢,

// Our method to create a PDF file natively on the iPhone
// This method takes two parameters, a CGRect for size and
// a const char, which will be the name of our pdf file
void CreatePDFFile (CGRect pageRect, const char *filename) {

    // This code block sets up our PDF Context so that we can draw to it
    CGContextRef pdfContext;
    CFStringRef path;
    CFURLRef url;
    CFMutableDictionaryRef myDictionary = NULL;
    // Create a CFString from the filename we provide …
Run Code Online (Sandbox Code Playgroud)

pdf iphone cocoa-touch objective-c quartz-graphics

3
推荐指数
2
解决办法
9900
查看次数

在UIWebview上编辑文本字段时的Dimiss键盘

我正在UIWebview上打开一个网页,这个页面有一个文本字段和一个虚拟键盘输入密码.但是当编辑文本字段时,iPhone虚拟键盘也会出现.我想解雇iPhone键盘并同时继续编辑文本字段.我尝试过以下但是没有用.

[webView stringByEvaluatingJavaScriptFromString:@"document.activeElement.blur()"];
Run Code Online (Sandbox Code Playgroud)

并且还尝试注册键盘通知,这样我就可以调低键盘,但没有成功.我很感激有关如何实现这一目标的任何想法.提前致谢.

[[NSNotificationCenter defaultCenter] addObserver:self
                                             selector:@selector (keyboardDidShow:)
                                                 name: UIKeyboardDidShowNotification object:nil];



-(void) keyboardDidShow: (NSNotification *)notif 
{
// I want to dismiss the keyboard 
}
Run Code Online (Sandbox Code Playgroud)

iphone cocoa-touch objective-c uiwebview uitextfield

2
推荐指数
1
解决办法
4866
查看次数

将View Controller推入导航控制器

有时,当我将ViewController推入导航控制器时,不会调用View Controller的viewDidLoad()方法.这导致我的应用程序崩溃.我将不胜感激任何帮助.

我忘记提到我在将其推入导航控制器之前从笔尖加载视图.

谢谢,莎拉

iphone cocoa-touch uinavigationcontroller

1
推荐指数
1
解决办法
9509
查看次数