小编Iev*_*ida的帖子

C#日期时间格式.本地化的字符串,如"sec""year"

我需要显示客户格式化的日期时间,如"12秒""2011年"
我如何获得本地化字符串"秒","年".在.net中是否存在特殊格式来获取这些字符串?

.net c# format datetime

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

C#pdf到文本转换器

可能重复:
在.Net中阅读PDF文档

是否有任何免费的库来呈现pdf.我需要解析pdf并分别显示图像和文本...感谢任何信息!

.net c# pdf

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

WCF + json.WCF响应无效,不是预期的字符串

我已经配置了wcf服务和方法返回一些结构.问题是响应'\'中的所有符号都以'/'开头示例:

    [
   {
      "rel":"http:\/\/localhost:3354\/customer\/1\/order",
      "uri":"http:\/\/localhost:3354\/customer\/1\/order\/3"
   },
   {
      "rel":"http:\/\/localhost:3354\/customer\/1\/order",
      "uri":"http:\/\/localhost:3354\/customer\/1\/order\/5"
   },
   {
      "rel":"http:\/\/localhost:3354\/customer\/1\/order",
      "uri":"http:\/\/localhost:3354\/customer\/1\/order\/8"
   }
]
Run Code Online (Sandbox Code Playgroud)

我只返回http:// localhost:3354/customer/1/order!为什么添加符号以及如何删除它们?

要么 @"http://cuustomer/1"

在json "http:\/\/cuustomer\/1"

.net c# wcf json

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

Ajax setRequestHeader不起作用

我正在尝试向ajax请求添加标头.

我使用setRequestHeader但它什么都不做.我可以在firefox中查看请求标头不包含身份验证!我做错了什么?

以及如何添加标题?

$.ajax({
       type: "POST",
       contentType: "application/json; charset=utf-8",
       url: "http://test/test.svc/news",
       dataType: "json",
       beforeSend : function(xhr) {
        xhr.setRequestHeader("Authentication", "Basic " + Base64.encode(username + ":" + password))
       },
       success: function(data) {
        alert('Success');
       },
       error: function() {
        alert("Loading data error...");
       }
      });
     }
Run Code Online (Sandbox Code Playgroud)

javascript authentication ajax jquery

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

带偏移量的 WPF 图像缩略图

我有一个 800x600 的图像,我会显示一个 90x30 的缩略图,其中一些偏移量 x=12 和 y 12。

我已经创建了一个画笔,但我正在努力应用偏移。

 var source = new ImageBrush(groundSource);
                source.Stretch = Stretch.None;
                source.AlignmentX = AlignmentX.Left;
                source.AlignmentY = AlignmentY.Top;
                source.RelativeTransform = new TranslateTransform(0.5, 0);
                var grid = new Grid();
                grid.ClipToBounds = true;
                grid.Background = source;
                grid.VerticalAlignment = System.Windows.VerticalAlignment.Top;
                grid.HorizontalAlignment = System.Windows.HorizontalAlignment.Left;
                grid.Margin = new System.Windows.Thickness(12, 12, 0, 0);
                grid.Width = SpriteSize.SpriteWidht + 33;
                grid.Height = SpriteSize.SpriteHeight;
                grid.SnapsToDevicePixels = true;
Run Code Online (Sandbox Code Playgroud)

我将不胜感激任何建议。

wpf grid image offset imagebrush

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

使用init.js的Sharepoint 2010包

我对位于文件夹中的sharepoint'init.js'进行了一些更改:

C:\ Program Files\Common Files\Microsoft Shared\Web Server Extensions\14\TEMPLATE\LAYOUTS\1033\init.js

我需要创建可以替换现有init.js的部署包.我怎样才能做到这一点?

.net sharepoint-2010

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

Sharepoint客户端API无效的DateTime字段

我有一个带有DateTime字段的SharePoint列表.我正在使用Silveright SharePoint客户端API来更新此字段.当我将值保存到该字段时,它将保存并在SharePoint中显示而不会出现问题.

但是当我试图获得该值时,它绝对不同(减去一些时间).它出什么问题了?

在SharePoint中,日期时间为:

在此输入图像描述

加载代码:

clientContext.Load(contactItem, item => item[Constants.TipFields.Title],
    item => item[Constants.TipFields.Description],
    item => item[Constants.TipFields.UserDefinedDateTime],
    item => item.Id);`
Run Code Online (Sandbox Code Playgroud)

这里我的日期不正确:

var description = tipItem[Constants.TipFields.Description] as String;
var title = tipItem[Constants.TipFields.Title] as String;
var date = tipItem[Constants.TipFields.UserDefinedDateTime] as DateTime;
Run Code Online (Sandbox Code Playgroud)

加载的日期时间是: 在此输入图像描述

这有什么不对?

c# silverlight sharepoint sharepoint-2010

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

使用.NET删除所有HTML标记并使用返回,空格等格式化文本

我有一个问题是剥离HTML并显示为客户格式的文本.

例如:

asdas<br/>asdas
Run Code Online (Sandbox Code Playgroud)

因此标签将被保证金替换.但我还需要用空格和制表符替换边距并删除所有标签.是否有任何示例或完成的解决方案,以便在删除HTML标记后以某种方式获取格式化文本.

当前的解决方案(寻找更好和完成):

/// <summary>
/// Methods to remove HTML from strings.
/// </summary>
public static class HtmlRemoval
{
    /// <summary>
    /// Compiled regular expression for performance.
    /// </summary>
    static Regex _htmlRegex = new Regex("<.*?>", RegexOptions.Compiled);

    /// <summary>
    /// Remove HTML from string with compiled Regex.
    /// </summary>
    public static string StripAllTagsRegex(string source)
    {
        source = HttpUtility.HtmlEncode(source);
        return _htmlRegex.Replace(source, string.Empty);
    }

    public static string ChangeTagsToTextFormat(string source)
    {
        if (string.IsNullOrEmpty(source))
            return source;

        source = HttpUtility.HtmlEncode(source);
        return source.Replace("<br/>", Environment.NewLine)
            .Replace("</div>", …
Run Code Online (Sandbox Code Playgroud)

.net html c#

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