当前位置:网站首页 > 更多 > 玩电脑 > 正文

[玩转系统] 如何在 SharePoint 中将多行文本字段类型设置为富文本或增强型富文本?

作者:精品下载站 日期:2024-12-14 14:53:07 浏览:12 分类:玩电脑

如何在 SharePoint 中将多行文本字段类型设置为富文本或增强型富文本?


要求:在 SharePoint 中将多行文本字段更改为富文本或增强型富文本

如何在 SharePoint 中将多行文本字段更改为富文本或增强型富文本字段?

您想在多行文本字段上启用富文本吗?在 SharePoint 中从纯文本转换为富文本或增强型富文本很简单,

  1. 进入列表设置>>点击栏目名称,进入栏目设置。
  2. 根据您的要求,将列类型选择为“富文本(粗体、斜体、文本对齐、超链接)”或“增强型富文本(带有图片、表格和超链接的富文本)”。
  3. 单击“确定”保存更改。

    [玩转系统] 如何在 SharePoint 中将多行文本字段类型设置为富文本或增强型富文本?

PowerShell 将多行文本字段类型设置为富文本

以下是将多行文本字段类型从纯文本更改为富文本或增强型富文本的 PowerShell:


Add-PSSnapin Microsoft.SharePoint.PowerShell -ErrorAction SilentlyContinue

#Set Parameters
$SiteURL = "https://intranet.crescent.com/sites/projects"
$ListName = "Projects"
$FieldInternalName="ProjectDescription"

#Get the web, List and Field objects
$web = Get-SPWeb $SiteURL
$List = $Web.Lists.TryGetList($ListName)
$Field = $List.Fields.TryGetFieldByStaticName($FieldInternalName)

#Check if the content type exists
If($Field -ne $NULL)
{
    #Set the Field Type "Rich Text"
    $Field.RichText = $True

    #Set Field Type to "Enhanced Rich Text"
    $Field.RichTextMode = "FullHtml"
    $Field.Update()
    Write-Host "Field Type Updated for '$($Field.Title)' Successfully!" -ForegroundColor Green
}
else
{
    Write-Host "Field '$FieldInternalName' doesn't Exist!" -ForegroundColor Red
}

您需要 登录账户 后才能发表评论

取消回复欢迎 发表评论:

关灯